邮件红点检测

This commit is contained in:
meixiongfeng 2022-11-21 18:06:15 +08:00
parent 24d78d9f66
commit 1bbc76d9aa
3 changed files with 49 additions and 1 deletions

View File

@ -24,7 +24,7 @@ type (
CreateNewMail(session IUserSession, mail *pb.DBMailData) bool CreateNewMail(session IUserSession, mail *pb.DBMailData) bool
SendNewMail(mail *pb.DBMailData, uid ...string) bool // 批量发送邮件 支持跨服 SendNewMail(mail *pb.DBMailData, uid ...string) bool // 批量发送邮件 支持跨服
///红点 ///红点
//IReddot IReddot
} }
//道具背包接口 //道具背包接口
IItems interface { IItems interface {

View File

@ -131,3 +131,31 @@ func (this *modelMail) MailQueryUserMailByReard(uId string) (mail []*pb.DBMailDa
} }
return return
} }
//附件红点
func (this *modelMail) checkReddot26(uid string) bool {
mailinfo, err := this.MailQueryUserMail(uid)
if err != nil {
return false
}
for _, v := range mailinfo {
if v.Reward && len(v.Items) > 0 {
return true
}
}
return false
}
// 未读红点
func (this *modelMail) checkReddot30(uid string) bool {
mailinfo, err := this.MailQueryUserMail(uid)
if err != nil {
return false
}
for _, v := range mailinfo {
if !v.Check {
return true
}
}
return false
}

View File

@ -121,3 +121,23 @@ func (this *Mail) SendNewMail(mail *pb.DBMailData, uid ...string) bool {
} }
return true return true
} }
//红点查询
func (this *Mail) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) {
reddot = make(map[comm.ReddotType]bool)
for _, v := range rid {
switch v {
case comm.Reddot26:
if isredot := this.modelMail.checkReddot26(session.GetUserId()); isredot {
reddot[comm.Reddot26] = true
}
break
case comm.Reddot30:
if isredot := this.modelMail.checkReddot30(session.GetUserId()); isredot {
reddot[comm.Reddot30] = true
}
break
}
}
return
}