diff --git a/modules/mail/api_getAttachment.go b/modules/mail/api_getAttachment.go index 04fd2e6da..2d112b38e 100644 --- a/modules/mail/api_getAttachment.go +++ b/modules/mail/api_getAttachment.go @@ -77,34 +77,25 @@ func (this *apiComp) GetAllMailAttachment(session comm.IUserSession, req *pb.Mai code = pb.ErrorCode_MailErr return } + fj := make([]*pb.UserAssets, 0) res := make([]*cfg.Game_atn, 0) for _, v := range mails { - for _, v1 := range v.Items { d := &cfg.Game_atn{ A: v1.A, T: v1.T, N: v1.N, } + fj = append(fj, v1) res = append(res, d) } code = this.module.api.module.DispenseRes(session, res, true) // 领取附件 if code == pb.ErrorCode_Success { - // 修改状态 this.module.modelMail.MailUpdateMailAttachmentState(v.ObjId) v.Reward = true - return } } - fj := make([]*pb.UserAssets, 0) - for _, v := range res { - atn1 := &pb.UserAssets{ - A: v.A, - T: v.T, - N: v.N, - } - fj = append(fj, atn1) - } + session.SendMsg(string(this.module.GetType()), "getusermailattachment", &pb.MailGetAllMailAttachmentResp{Res: fj}) return } diff --git a/modules/mail/api_readmail.go b/modules/mail/api_readmail.go index 65c15351d..0b34a01e1 100644 --- a/modules/mail/api_readmail.go +++ b/modules/mail/api_readmail.go @@ -2,7 +2,6 @@ package mail import ( "go_dreamfactory/comm" - "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" @@ -25,7 +24,7 @@ func (this *apiComp) ReadMail(session comm.IUserSession, req *pb.MailReadMailReq code = this.ReadMailCheck(session, req) // check if code != pb.ErrorCode_Success { - log.Debugf("read mail failed%d", code) + this.module.Debugf("read mail failed%d", code) return } mail, err = this.module.modelMail.MailReadOneMail(req.ObjID) @@ -33,7 +32,7 @@ func (this *apiComp) ReadMail(session comm.IUserSession, req *pb.MailReadMailReq code = pb.ErrorCode_ReqParameterError return } - log.Debugf("read mail %v", mail) + this.module.Debugf("read mail %v", mail) mail.Check = true session.SendMsg(string(this.module.GetType()), "readmail", &pb.MailReadMailResp{Mail: mail}) return diff --git a/modules/mail/model_mail.go b/modules/mail/model_mail.go index 95fa1f676..b7a39ab88 100644 --- a/modules/mail/model_mail.go +++ b/modules/mail/model_mail.go @@ -122,7 +122,7 @@ func (this *modelMail) MailDelUserMail(objId string) bool { func (this *modelMail) MailQueryUserMailByReard(uId string) (mail []*pb.DBMailData, err error) { - if _data, err := this.DB.Find(DB_MailTable, bson.M{"uid": uId, "Reward": false}); err == nil { + if _data, err := this.DB.Find(DB_MailTable, bson.M{"uid": uId, "reward": false}); err == nil { for _data.Next(context.TODO()) { temp := &pb.DBMailData{} if err = _data.Decode(temp); err == nil {