From fe136f26ea409feeea086792fae349675207b71a Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 4 Jul 2022 17:15:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E9=82=AE=E4=BB=B6=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 2 +- modules/mail/module.go | 29 +++++++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/comm/imodule.go b/comm/imodule.go index f72e5fb1e..a079d629b 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -17,7 +17,7 @@ type ( //邮件业务模块对外接口定义 提供给其他模块使用的 Imail interface { - CreateNewMail(uId string) + CreateNewMail(uId string, mail *pb.DBMailData) bool } //道具背包接口 IItems interface { diff --git a/modules/mail/module.go b/modules/mail/module.go index e60c2ee26..088a57d01 100644 --- a/modules/mail/module.go +++ b/modules/mail/module.go @@ -4,12 +4,9 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/modules" "go_dreamfactory/pb" - "time" "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/log" - - "go.mongodb.org/mongo-driver/bson/primitive" ) /* @@ -40,16 +37,19 @@ func (this *Mail) OnInstallComp() { this.configure_comp = this.RegisterComp(new(Configure_Comp)).(*Configure_Comp) } -func (this *Mail) CreateNewMail(uId string) { - mail := &pb.DBMailData{ - ObjId: primitive.NewObjectID().Hex(), - Uid: uId, - Title: "系统邮件", - Contex: "恭喜获得专属礼包一份", - CreateTime: uint64(time.Now().Unix()), - DueTime: uint64(time.Now().Unix()) + 30*24*3600, // 30天需要走配置文件 - Check: false, - Reward: false, +func (this *Mail) CreateNewMail(uId string, mail *pb.DBMailData) bool { + // mail := &pb.DBMailData{ + // ObjId: primitive.NewObjectID().Hex(), + // Uid: uId, + // Title: "系统邮件", + // Contex: "恭喜获得专属礼包一份", + // CreateTime: uint64(time.Now().Unix()), + // DueTime: uint64(time.Now().Unix()) + 30*24*3600, // 30天需要走配置文件 + // Check: false, + // Reward: false, + // } + if mail == nil { + return false } err := this.modelMail.Mail_InsertUserMail(mail) if err != nil { @@ -59,8 +59,9 @@ func (this *Mail) CreateNewMail(uId string) { var _cache = &pb.CacheUser{} err = this.modelMail.MCompModel.Get(uId, _cache) if err == nil { - return + return false } this.SendMsgToUser(string(this.GetType()), GetNewEMailResp, mail, _cache) + return true }