一键领取

This commit is contained in:
meixiongfeng 2022-08-01 18:39:44 +08:00
parent b6f1fe1c02
commit 80ff9fffc7
3 changed files with 6 additions and 16 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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 {