Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
496c7a405f
@ -589,5 +589,39 @@
|
||||
"needracestar": 0,
|
||||
"needracenum": 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
|
||||
}
|
||||
]
|
@ -16,6 +16,7 @@ type (
|
||||
//邮件业务模块对外接口定义 提供给其他模块使用的
|
||||
Imail interface {
|
||||
CreateNewMail(session IUserSession, mail *pb.DBMailData) bool
|
||||
SendNewMail(mail *pb.DBMailData, uid ...string) bool // 批量发送邮件 支持跨服
|
||||
}
|
||||
//道具背包接口
|
||||
IItems interface {
|
||||
|
@ -83,3 +83,40 @@ func (this *Mail) AddNewMailPush(session comm.IUserSession, mail *pb.DBMailData)
|
||||
session.SendMsg(string(this.GetType()), "getnewmail", &pb.MailGetNewMailPush{Mail: mail})
|
||||
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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user