一键领取

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 code = pb.ErrorCode_MailErr
return return
} }
fj := make([]*pb.UserAssets, 0)
res := make([]*cfg.Game_atn, 0) res := make([]*cfg.Game_atn, 0)
for _, v := range mails { for _, v := range mails {
for _, v1 := range v.Items { for _, v1 := range v.Items {
d := &cfg.Game_atn{ d := &cfg.Game_atn{
A: v1.A, A: v1.A,
T: v1.T, T: v1.T,
N: v1.N, N: v1.N,
} }
fj = append(fj, v1)
res = append(res, d) res = append(res, d)
} }
code = this.module.api.module.DispenseRes(session, res, true) // 领取附件 code = this.module.api.module.DispenseRes(session, res, true) // 领取附件
if code == pb.ErrorCode_Success { if code == pb.ErrorCode_Success {
// 修改状态
this.module.modelMail.MailUpdateMailAttachmentState(v.ObjId) this.module.modelMail.MailUpdateMailAttachmentState(v.ObjId)
v.Reward = true 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}) session.SendMsg(string(this.module.GetType()), "getusermailattachment", &pb.MailGetAllMailAttachmentResp{Res: fj})
return return
} }

View File

@ -2,7 +2,6 @@ package mail
import ( import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"google.golang.org/protobuf/proto" "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 code = this.ReadMailCheck(session, req) // check
if code != pb.ErrorCode_Success { if code != pb.ErrorCode_Success {
log.Debugf("read mail failed%d", code) this.module.Debugf("read mail failed%d", code)
return return
} }
mail, err = this.module.modelMail.MailReadOneMail(req.ObjID) 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 code = pb.ErrorCode_ReqParameterError
return return
} }
log.Debugf("read mail %v", mail) this.module.Debugf("read mail %v", mail)
mail.Check = true mail.Check = true
session.SendMsg(string(this.module.GetType()), "readmail", &pb.MailReadMailResp{Mail: mail}) session.SendMsg(string(this.module.GetType()), "readmail", &pb.MailReadMailResp{Mail: mail})
return 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) { 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()) { for _data.Next(context.TODO()) {
temp := &pb.DBMailData{} temp := &pb.DBMailData{}
if err = _data.Decode(temp); err == nil { if err = _data.Decode(temp); err == nil {