This commit is contained in:
liwei1dao 2022-10-26 18:07:49 +08:00
commit 496c7a405f
3 changed files with 72 additions and 0 deletions

View File

@ -589,5 +589,39 @@
"needracestar": 0, "needracestar": 0,
"needracenum": 0, "needracenum": 0,
"gold": 0 "gold": 0
},
{
"key": 39,
"id": "43901",
"star": 4,
"needhero": "",
"needherostar": 0,
"needheronum": 0,
"needrace": [
1,
2,
3,
4
],
"needracestar": 4,
"needracenum": 4,
"gold": 10000
},
{
"key": 40,
"id": "43902",
"star": 5,
"needhero": "",
"needherostar": 0,
"needheronum": 0,
"needrace": [
1,
2,
3,
4
],
"needracestar": 5,
"needracenum": 5,
"gold": 10000
} }
] ]

View File

@ -16,6 +16,7 @@ type (
//邮件业务模块对外接口定义 提供给其他模块使用的 //邮件业务模块对外接口定义 提供给其他模块使用的
Imail interface { Imail interface {
CreateNewMail(session IUserSession, mail *pb.DBMailData) bool CreateNewMail(session IUserSession, mail *pb.DBMailData) bool
SendNewMail(mail *pb.DBMailData, uid ...string) bool // 批量发送邮件 支持跨服
} }
//道具背包接口 //道具背包接口
IItems interface { IItems interface {

View File

@ -83,3 +83,40 @@ func (this *Mail) AddNewMailPush(session comm.IUserSession, mail *pb.DBMailData)
session.SendMsg(string(this.GetType()), "getnewmail", &pb.MailGetNewMailPush{Mail: mail}) session.SendMsg(string(this.GetType()), "getnewmail", &pb.MailGetNewMailPush{Mail: mail})
return return
} }
// 给多个用户发邮件
func (this *Mail) SendNewMail(mail *pb.DBMailData, uid ...string) bool {
if db.IsCross() {
for _, id := range uid {
tag, _, b := utils.UIdSplit(id)
if b {
if conn, err := db.ServerDBConn(tag); err == nil {
dbModel := db.NewDBModel(comm.TableMail, time.Hour, conn)
mail.ObjId = primitive.NewObjectID().Hex()
mail.Check = false
mail.Reward = false
if len(mail.GetItems()) > 0 {
mail.Reward = false
}
_, err = dbModel.DB.InsertOne(comm.TableMail, mail)
this.SendMsgToUser(string(this.GetType()), "getnewmail", &pb.MailGetNewMailPush{Mail: mail}, id)
}
}
}
} else {
for _, id := range uid {
mail.Uid = id
mail.ObjId = primitive.NewObjectID().Hex()
mail.Check = false
mail.Reward = false
if len(mail.GetItems()) > 0 {
mail.Reward = false
}
this.modelMail.DB.InsertOne(comm.TableMail, mail)
this.SendMsgToUser(string(this.GetType()), "getnewmail", &pb.MailGetNewMailPush{Mail: mail}, id)
}
}
return true
}