创角发欢迎邮件
This commit is contained in:
parent
b11fb0b493
commit
c2e1a230fe
@ -17,6 +17,7 @@
|
||||
"key": "MailSender_GuildDissolution",
|
||||
"text": "系统"
|
||||
},
|
||||
"reword": [],
|
||||
"duration": 720
|
||||
},
|
||||
{
|
||||
@ -37,6 +38,7 @@
|
||||
"key": "MailSender_GuildExpel",
|
||||
"text": "系统"
|
||||
},
|
||||
"reword": [],
|
||||
"duration": 720
|
||||
},
|
||||
{
|
||||
@ -57,6 +59,7 @@
|
||||
"key": "MailSender_GuildApproved",
|
||||
"text": "系统"
|
||||
},
|
||||
"reword": [],
|
||||
"duration": 720
|
||||
},
|
||||
{
|
||||
@ -77,6 +80,7 @@
|
||||
"key": "MailSender_Activity_PrivilegeCardDailyReward_lv1",
|
||||
"text": "系统"
|
||||
},
|
||||
"reword": [],
|
||||
"duration": 720
|
||||
},
|
||||
{
|
||||
@ -97,6 +101,7 @@
|
||||
"key": "MailSender_Activity_PrivilegeCardDailyReward_lv2",
|
||||
"text": "系统"
|
||||
},
|
||||
"reword": [],
|
||||
"duration": 720
|
||||
},
|
||||
{
|
||||
@ -117,6 +122,7 @@
|
||||
"key": "MailSender_SeasonPagodaReward",
|
||||
"text": "系统"
|
||||
},
|
||||
"reword": [],
|
||||
"duration": 720
|
||||
},
|
||||
{
|
||||
@ -137,6 +143,7 @@
|
||||
"key": "MailSender_ArenaRankingReward",
|
||||
"text": "系统"
|
||||
},
|
||||
"reword": [],
|
||||
"duration": 720
|
||||
},
|
||||
{
|
||||
@ -157,6 +164,7 @@
|
||||
"key": "MailSender_CaravanReward",
|
||||
"text": "系统"
|
||||
},
|
||||
"reword": [],
|
||||
"duration": 720
|
||||
},
|
||||
{
|
||||
@ -177,6 +185,7 @@
|
||||
"key": "MailSender_VipLvReward",
|
||||
"text": "商会管理员"
|
||||
},
|
||||
"reword": [],
|
||||
"duration": 720
|
||||
},
|
||||
{
|
||||
@ -197,6 +206,34 @@
|
||||
"key": "MailSender_Drivethemail",
|
||||
"text": "系统"
|
||||
},
|
||||
"reword": [],
|
||||
"duration": 720
|
||||
},
|
||||
{
|
||||
"id": "Welcomemail",
|
||||
"title": {
|
||||
"key": "Welcomemail",
|
||||
"text": "欢迎"
|
||||
},
|
||||
"recipient": {
|
||||
"key": "MailRecipient_Welcomemail",
|
||||
"text": "亲爱的玩家:"
|
||||
},
|
||||
"content": {
|
||||
"key": "MailContent_Welcomemail",
|
||||
"text": "欢迎来到梦工场世界!以下是一点礼品,请笑纳。"
|
||||
},
|
||||
"sender": {
|
||||
"key": "MailSender_Welcomemail",
|
||||
"text": "系统"
|
||||
},
|
||||
"reword": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 50
|
||||
}
|
||||
],
|
||||
"duration": 720
|
||||
}
|
||||
]
|
@ -672,9 +672,10 @@ const (
|
||||
|
||||
// 邮件ID
|
||||
const (
|
||||
Yueka_1 string = "Activity_PrivilegeCardDailyReward_lv1" //月卡1
|
||||
Yueka_2 string = "Activity_PrivilegeCardDailyReward_lv2" // 月卡2
|
||||
VipDaily string = "VipLvReward" // vip每日奖励
|
||||
Yueka_1 string = "Activity_PrivilegeCardDailyReward_lv1" //月卡1
|
||||
Yueka_2 string = "Activity_PrivilegeCardDailyReward_lv2" // 月卡2
|
||||
VipDaily string = "VipLvReward" // vip每日奖励
|
||||
Welcomemail string = "Welcomemail" // 欢迎邮件
|
||||
)
|
||||
|
||||
// open funcName
|
||||
|
@ -2,15 +2,51 @@ package mail
|
||||
|
||||
import (
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/sys/configure"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
// 邮件配置管理组件
|
||||
const (
|
||||
game_mail = "game_mail.json"
|
||||
)
|
||||
|
||||
///配置管理基础组件
|
||||
type Configure_Comp struct {
|
||||
modules.MCompConfigure
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
func (this *Configure_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
this.MCompConfigure.Init(service, module, comp, options)
|
||||
err = this.MCompConfigure.Init(service, module, comp, options)
|
||||
this.LoadConfigure(game_mail, cfg.NewGameMail)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
//加载多个配置文件
|
||||
func (this *Configure_Comp) LoadMultiConfigure(confs map[string]interface{}) (err error) {
|
||||
for k, v := range confs {
|
||||
err = configure.RegisterConfigure(k, v, nil)
|
||||
if err != nil {
|
||||
log.Errorf("配置文件:%s解析失败!", k)
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//读取配置数据
|
||||
func (this *Configure_Comp) GetConfigure(name string) (v interface{}, err error) {
|
||||
return configure.GetConfigure(name)
|
||||
}
|
||||
|
||||
func (this *Configure_Comp) GetMailConf(key string) (data *cfg.GameMailData) {
|
||||
if v, err := this.GetConfigure(game_mail); err == nil {
|
||||
if configure, ok := v.(*cfg.GameMail); ok {
|
||||
return configure.Get(key)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -29,10 +29,10 @@ func NewModule() core.IModule {
|
||||
|
||||
type Mail struct {
|
||||
modules.ModuleBase
|
||||
api *apiComp
|
||||
modelMail *modelMail
|
||||
configure_comp *Configure_Comp
|
||||
service base.IRPCXService
|
||||
api *apiComp
|
||||
modelMail *modelMail
|
||||
configure *Configure_Comp
|
||||
service base.IRPCXService
|
||||
}
|
||||
|
||||
func (this *Mail) GetType() core.M_Modules {
|
||||
@ -43,7 +43,7 @@ func (this *Mail) OnInstallComp() {
|
||||
this.ModuleBase.OnInstallComp()
|
||||
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||
this.modelMail = this.RegisterComp(new(modelMail)).(*modelMail)
|
||||
this.configure_comp = this.RegisterComp(new(Configure_Comp)).(*Configure_Comp)
|
||||
this.configure = this.RegisterComp(new(Configure_Comp)).(*Configure_Comp)
|
||||
}
|
||||
|
||||
func (this *Mail) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
@ -152,6 +152,21 @@ func (this *Mail) Rpc_Mail(ctx context.Context, args *pb.DBMailData) (err error)
|
||||
}
|
||||
func (this *Mail) SendMailByCid(session comm.IUserSession, cid string, res []*pb.UserAssets) bool {
|
||||
|
||||
// 获取额外配置
|
||||
conf := this.configure.GetMailConf(cid)
|
||||
if conf != nil {
|
||||
this.Errorf("can't found mail by cid: %s", cid)
|
||||
return false
|
||||
}
|
||||
if len(conf.Reword) > 0 {
|
||||
for _, v := range conf.Reword {
|
||||
res = append(res, &pb.UserAssets{
|
||||
A: v.A,
|
||||
T: v.T,
|
||||
N: v.N,
|
||||
})
|
||||
}
|
||||
}
|
||||
// 构建一个每日奖励邮件对象
|
||||
mail := &pb.DBMailData{
|
||||
ObjId: primitive.NewObjectID().Hex(),
|
||||
|
@ -119,5 +119,8 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (c
|
||||
if req.Figure != 0 {
|
||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype72, 1)
|
||||
}
|
||||
|
||||
this.mail.SendMailByCid(session, comm.Welcomemail, nil)
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ type GameMailData struct {
|
||||
Recipient string
|
||||
Content string
|
||||
Sender string
|
||||
Reword []*Gameatn
|
||||
Duration int32
|
||||
}
|
||||
|
||||
@ -31,6 +32,20 @@ func (_v *GameMailData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["recipient"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Recipient error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Recipient, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
|
||||
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["content"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Content error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Content, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
|
||||
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["sender"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Sender error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Sender, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["reword"].([]interface{}); !_ok_ { err = errors.New("reword error"); return }
|
||||
|
||||
_v.Reword = make([]*Gameatn, 0, len(_arr_))
|
||||
|
||||
for _, _e_ := range _arr_ {
|
||||
var _list_v_ *Gameatn
|
||||
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
|
||||
_v.Reword = append(_v.Reword, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["duration"].(float64); !_ok_ { err = errors.New("duration error"); return }; _v.Duration = int32(_tempNum_) }
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user