邮件批处理
This commit is contained in:
parent
9df2c3f7b5
commit
292d007e29
@ -662,6 +662,11 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
|
||||
Check: false,
|
||||
Reward: false,
|
||||
}
|
||||
mail.Items = append(mail.Items, &pb.UserAssets{
|
||||
A: "attr",
|
||||
T: "gold",
|
||||
N: 1,
|
||||
})
|
||||
if len(mail.Items) > 0 {
|
||||
mail.Reward = true
|
||||
}
|
||||
|
@ -71,6 +71,8 @@ func (this *apiComp) GetAllMailAttachment(session comm.IUserSession, req *pb.Mai
|
||||
|
||||
var (
|
||||
mailIds []string
|
||||
atno []*pb.UserAtno
|
||||
res []*cfg.Gameatn
|
||||
)
|
||||
if errdata = this.GetAllMailAttachmentCheck(session, req); errdata != nil {
|
||||
return
|
||||
@ -91,28 +93,31 @@ func (this *apiComp) GetAllMailAttachment(session comm.IUserSession, req *pb.Mai
|
||||
}
|
||||
return
|
||||
}
|
||||
fj := make([]*pb.UserAssets, 0)
|
||||
|
||||
for _, v := range mails {
|
||||
res := make([]*cfg.Gameatn, 0)
|
||||
bok := false
|
||||
for _, v1 := range v.Items {
|
||||
d := &cfg.Gameatn{
|
||||
A: v1.A,
|
||||
T: v1.T,
|
||||
N: v1.N,
|
||||
}
|
||||
fj = append(fj, v1)
|
||||
res = append(res, d)
|
||||
bok = true
|
||||
}
|
||||
if errdata = this.module.DispenseRes(session, res, true); errdata == nil {
|
||||
this.module.modelMail.MailUpdateMailAttachmentState(v.ObjId)
|
||||
if bok {
|
||||
v.Reward = true
|
||||
v.Check = true
|
||||
mailIds = append(mailIds, v.ObjId)
|
||||
}
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), "getallmailattachment", &pb.MailGetAllMailAttachmentResp{Res: fj,
|
||||
Ids: mailIds})
|
||||
if errdata, atno = this.module.DispenseAtno(session, res, true); errdata != nil {
|
||||
return
|
||||
}
|
||||
this.module.modelMail.MailGetAttachmentMail(mailIds)
|
||||
session.SendMsg(string(this.module.GetType()), "getallmailattachment", &pb.MailGetAllMailAttachmentResp{
|
||||
Res: atno,
|
||||
Ids: mailIds,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
@ -192,3 +193,18 @@ func (this *modelMail) checkReddot30(uid string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
func (this *modelMail) MailGetAttachmentMail(objId []string) bool {
|
||||
Where := bson.M{}
|
||||
Query := bson.M{
|
||||
"reward": true,
|
||||
"check": true,
|
||||
}
|
||||
|
||||
Where = bson.M{"_id": bson.M{"$in": objId}}
|
||||
data, err := this.DB.UpdateMany(core.SqlTable(comm.TableMail), Where, bson.M{"$set": Query}, options.MergeUpdateOptions().SetUpsert(true))
|
||||
if err != nil {
|
||||
log.Errorf("Update : %+v err :%v, ", data, err)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user