From 24d78d9f66e417b9a7b82ddf23756f1c4041056f Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 21 Nov 2022 16:54:15 +0800 Subject: [PATCH 1/2] update --- comm/imodule.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comm/imodule.go b/comm/imodule.go index 84da7c71e..c190bcf70 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -24,7 +24,7 @@ type ( CreateNewMail(session IUserSession, mail *pb.DBMailData) bool SendNewMail(mail *pb.DBMailData, uid ...string) bool // 批量发送邮件 支持跨服 ///红点 - IReddot + //IReddot } //道具背包接口 IItems interface { From 1bbc76d9aaba706c954ea3d94efb621269c8254f Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 21 Nov 2022 18:06:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E7=BA=A2=E7=82=B9?= =?UTF-8?q?=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 2 +- modules/mail/model_mail.go | 28 ++++++++++++++++++++++++++++ modules/mail/module.go | 20 ++++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/comm/imodule.go b/comm/imodule.go index c190bcf70..84da7c71e 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -24,7 +24,7 @@ type ( CreateNewMail(session IUserSession, mail *pb.DBMailData) bool SendNewMail(mail *pb.DBMailData, uid ...string) bool // 批量发送邮件 支持跨服 ///红点 - //IReddot + IReddot } //道具背包接口 IItems interface { 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 +}