特权 vip奖励补发
This commit is contained in:
parent
4ecb3bff6c
commit
dd5ca57457
@ -22,7 +22,6 @@ type (
|
||||
//邮件业务模块对外接口定义 提供给其他模块使用的
|
||||
Imail interface {
|
||||
SendMailByCid(session IUserSession, cid string, res []*pb.UserAssets) bool
|
||||
CreateNewMail(session IUserSession, mail *pb.DBMailData) bool
|
||||
SendNewMail(mail *pb.DBMailData, uid ...string) bool // 批量发送邮件 支持跨服
|
||||
IReddot
|
||||
}
|
||||
|
@ -46,41 +46,6 @@ func (this *Mail) OnInstallComp() {
|
||||
this.configure_comp = this.RegisterComp(new(Configure_Comp)).(*Configure_Comp)
|
||||
}
|
||||
|
||||
func (this *Mail) CreateNewMail(session comm.IUserSession, mail *pb.DBMailData) bool {
|
||||
t := configure.Now()
|
||||
defer func() {
|
||||
log.Debugf("创建邮件 耗时:%v", time.Since(t))
|
||||
}()
|
||||
if mail == nil {
|
||||
return false
|
||||
}
|
||||
if db.IsCross() { // 如果是跨服 则取本服的db
|
||||
tag, _, b := utils.UIdSplit(session.GetUserId())
|
||||
if b {
|
||||
if conn, err := db.ServerDBConn(tag); err == nil {
|
||||
dbModel := db.NewDBModel(comm.TableMail, time.Hour, conn)
|
||||
mail.ObjId = primitive.NewObjectID().Hex()
|
||||
mail.Check = false
|
||||
mail.Reward = true
|
||||
|
||||
if len(mail.GetItems()) > 0 {
|
||||
mail.Reward = false
|
||||
}
|
||||
_, err = dbModel.DB.InsertOne(comm.TableMail, mail)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
err := this.modelMail.MailInsertUserMail(mail)
|
||||
if err != nil {
|
||||
this.Errorf("create mail failed :%v", err)
|
||||
return false
|
||||
}
|
||||
}
|
||||
// 通知玩家
|
||||
this.AddNewMailPush(session, mail)
|
||||
|
||||
return true
|
||||
}
|
||||
func (this *Mail) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
err = this.ModuleBase.Init(service, module, options)
|
||||
this.service = service.(base.IRPCXService)
|
||||
|
@ -302,26 +302,12 @@ func (this *Privilege) SendDailyMail(session comm.IUserSession, cId string, coun
|
||||
})
|
||||
}
|
||||
|
||||
// 构建一个每日奖励邮件对象
|
||||
mail := &pb.DBMailData{
|
||||
ObjId: "",
|
||||
Uid: session.GetUserId(),
|
||||
CreateTime: uint64(configure.Now().Unix()),
|
||||
DueTime: uint64(configure.Now().Unix() + 30*24*3600),
|
||||
Check: false,
|
||||
Reward: false,
|
||||
Items: res,
|
||||
Param: []string{},
|
||||
}
|
||||
if pType == 1 {
|
||||
mail.Cid = comm.Yueka_1
|
||||
this.mail.SendMailByCid(session, comm.Yueka_1, res)
|
||||
} else if pType == 2 {
|
||||
mail.Cid = comm.Yueka_2
|
||||
}
|
||||
for i := 0; i < int(count); i++ {
|
||||
mail.ObjId = primitive.NewObjectID().Hex()
|
||||
this.mail.CreateNewMail(session, mail)
|
||||
this.mail.SendMailByCid(session, comm.Yueka_1, res)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (this *Privilege) CheckAllPrivilege(session comm.IUserSession) map[int32]*pb.PrivilegeList {
|
||||
|
@ -7,7 +7,6 @@ import (
|
||||
"go_dreamfactory/sys/configure"
|
||||
"go_dreamfactory/utils"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
@ -149,20 +148,6 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
|
||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype7, 1)
|
||||
|
||||
this.module.ModulePrivilege.CheckDailyPrivilegeMail(session)
|
||||
//推送登录公告
|
||||
if this.module.modelUser.isLoginFirst(lastLoginTime) {
|
||||
this.chat.SendSysChatToUser(session, comm.ChatSystem2, 0, 0)
|
||||
mail := &pb.DBMailData{
|
||||
ObjId: primitive.NewObjectID().Hex(),
|
||||
Uid: user.Uid,
|
||||
Title: "system mail",
|
||||
Contex: "Congratulations on getting a login exclusive gift pack",
|
||||
CreateTime: uint64(configure.Now().Unix()),
|
||||
DueTime: uint64(configure.Now().Unix()) + 30*24*3600, // 30天需要走配置文件
|
||||
Check: false,
|
||||
Reward: false,
|
||||
}
|
||||
this.mail.CreateNewMail(session, mail)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user