diff --git a/modules/mail/model_mail.go b/modules/mail/model_mail.go index 93794043b..445bf8203 100644 --- a/modules/mail/model_mail.go +++ b/modules/mail/model_mail.go @@ -131,3 +131,31 @@ func (this *modelMail) MailQueryUserMailByReard(uId string) (mail []*pb.DBMailDa } 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 +} diff --git a/modules/mail/module.go b/modules/mail/module.go index 8e1b686e2..266c15430 100644 --- a/modules/mail/module.go +++ b/modules/mail/module.go @@ -121,3 +121,23 @@ func (this *Mail) SendNewMail(mail *pb.DBMailData, uid ...string) bool { } 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 +}