批量发送邮件改红点推送

This commit is contained in:
meixiongfeng 2023-07-19 10:13:32 +08:00
parent 438dda8e45
commit 1033d34b64
2 changed files with 11 additions and 19 deletions

View File

@ -53,7 +53,7 @@ type (
// 所有邮件奖励统一调这个接口 // 所有邮件奖励统一调这个接口
SendRewardMailByCid(session IUserSession, cid string, res []*cfg.Gameatn) bool SendRewardMailByCid(session IUserSession, cid string, res []*cfg.Gameatn) bool
// 批量发邮件结果: cid 邮件表ID, 没有附件 res 传空 // 批量发邮件结果: cid 邮件表ID, 没有附件 res 传空
SendMailToUsers(uids []string, cid string, res []*cfg.Gameatn, param []string, bPush bool) bool // 批量发送邮件 支持跨服 SendMailToUsers(uids []string, cid string, res []*cfg.Gameatn, param []string) bool // 批量发送邮件 支持跨服
} }
//道具背包接口 //道具背包接口
IItems interface { IItems interface {

View File

@ -365,7 +365,7 @@ func (this *Mail) SendRewardMailByCid(session comm.IUserSession, cid string, res
return true return true
} }
func (this *Mail) SendMailToUsers(uids []string, cid string, res []*cfg.Gameatn, param []string, bPush bool) bool { func (this *Mail) SendMailToUsers(uids []string, cid string, res []*cfg.Gameatn, param []string) bool {
var ( var (
resReward []*pb.UserAssets resReward []*pb.UserAssets
) )
@ -411,14 +411,6 @@ func (this *Mail) SendMailToUsers(uids []string, cid string, res []*cfg.Gameatn,
mail.Reward = false mail.Reward = false
} }
_, err = dbModel.DB.InsertOne(comm.TableMail, mail) _, err = dbModel.DB.InsertOne(comm.TableMail, mail)
if bPush {
if session, ok := this.GetUserSession(id); ok { // 通知玩家
session.SendMsg(string(this.GetType()), "getnewmail", &pb.MailGetNewMailPush{Mail: mail})
if err := session.Push(); err != nil {
this.Errorf("err:%v", err)
}
}
}
} }
} }
} }
@ -442,16 +434,16 @@ func (this *Mail) SendMailToUsers(uids []string, cid string, res []*cfg.Gameatn,
mail.Reward = false mail.Reward = false
} }
this.modelMail.DB.InsertOne(comm.TableMail, mail) this.modelMail.DB.InsertOne(comm.TableMail, mail)
if bPush {
if session, ok := this.GetUserSession(id); ok { // 通知玩家
session.SendMsg(string(this.GetType()), "getnewmail", &pb.MailGetNewMailPush{Mail: mail})
if err := session.Push(); err != nil {
this.Errorf("err:%v", err)
}
}
}
} }
} }
redot := &pb.ReddotItem{
Rid: int32(comm.Reddot12102),
Activated: false,
Nextchanagetime: 0,
}
this.SendMsgToUsers("reddot", "change", &pb.ReddotChangePush{
Rids: []*pb.ReddotItem{redot},
}, uids...)
return true return true
} }