创建邮件接口

This commit is contained in:
meixiongfeng 2022-07-04 17:15:01 +08:00
parent 5aefe22270
commit fe136f26ea
2 changed files with 16 additions and 15 deletions

View File

@ -17,7 +17,7 @@ type (
//邮件业务模块对外接口定义 提供给其他模块使用的 //邮件业务模块对外接口定义 提供给其他模块使用的
Imail interface { Imail interface {
CreateNewMail(uId string) CreateNewMail(uId string, mail *pb.DBMailData) bool
} }
//道具背包接口 //道具背包接口
IItems interface { IItems interface {

View File

@ -4,12 +4,9 @@ import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"time"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log" "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) this.configure_comp = this.RegisterComp(new(Configure_Comp)).(*Configure_Comp)
} }
func (this *Mail) CreateNewMail(uId string) { func (this *Mail) CreateNewMail(uId string, mail *pb.DBMailData) bool {
mail := &pb.DBMailData{ // mail := &pb.DBMailData{
ObjId: primitive.NewObjectID().Hex(), // ObjId: primitive.NewObjectID().Hex(),
Uid: uId, // Uid: uId,
Title: "系统邮件", // Title: "系统邮件",
Contex: "恭喜获得专属礼包一份", // Contex: "恭喜获得专属礼包一份",
CreateTime: uint64(time.Now().Unix()), // CreateTime: uint64(time.Now().Unix()),
DueTime: uint64(time.Now().Unix()) + 30*24*3600, // 30天需要走配置文件 // DueTime: uint64(time.Now().Unix()) + 30*24*3600, // 30天需要走配置文件
Check: false, // Check: false,
Reward: false, // Reward: false,
// }
if mail == nil {
return false
} }
err := this.modelMail.Mail_InsertUserMail(mail) err := this.modelMail.Mail_InsertUserMail(mail)
if err != nil { if err != nil {
@ -59,8 +59,9 @@ func (this *Mail) CreateNewMail(uId string) {
var _cache = &pb.CacheUser{} var _cache = &pb.CacheUser{}
err = this.modelMail.MCompModel.Get(uId, _cache) err = this.modelMail.MCompModel.Get(uId, _cache)
if err == nil { if err == nil {
return return false
} }
this.SendMsgToUser(string(this.GetType()), GetNewEMailResp, mail, _cache) this.SendMsgToUser(string(this.GetType()), GetNewEMailResp, mail, _cache)
return true
} }