月卡每日奖励支持多语言

This commit is contained in:
meixiongfeng 2022-11-10 18:04:05 +08:00
parent d1cd3e243a
commit f059dd5ca5
4 changed files with 24 additions and 4 deletions

View File

@ -1,6 +1,7 @@
[
{
"id": "yueka_lv1",
"pType": 1,
"name": "经典月卡",
"assert_day": 30,
"renew_day": 3,
@ -26,6 +27,7 @@
},
{
"id": "yueka_lv2",
"pType": 2,
"name": "典藏月卡",
"assert_day": 30,
"renew_day": 3,
@ -51,6 +53,7 @@
},
{
"id": "passcheck_1",
"pType": 3,
"name": "爬塔战令",
"assert_day": 30,
"renew_day": 0,

View File

@ -469,3 +469,9 @@ const (
TrollSurprise //惊喜货物售价系数
)
// 邮件ID
const (
Yueka_1 string = "Activity_PrivilegeCardDailyReward_lv1"
Yueka_2 string = "Activity_PrivilegeCardDailyReward_lv2"
)

View File

@ -112,6 +112,7 @@ func (this *Privilege) CreatePrivilegeCard(session comm.IUserSession, cId string
}
}
if !bFind {
data = &pb.DBPrivilege{
Id: primitive.NewObjectID().Hex(),
Uid: session.GetUserId(),
@ -126,7 +127,7 @@ func (this *Privilege) CreatePrivilegeCard(session comm.IUserSession, cId string
data.PrivilegeID = append(data.PrivilegeID, v)
}
this.modelPrivilege.addNewPrivilegeData(session.GetUserId(), data)
this.SendDailyMail(session, cId, 1)
this.SendDailyMail(session, cId, 1, conf.PType)
}
if code = this.DispenseRes(session, conf.DisposableReward, true); code != pb.ErrorCode_Success {
@ -232,7 +233,10 @@ func (this *Privilege) QueryPrivilege(session comm.IUserSession) (privilegeID []
this.Errorf("delete privilege failed:%v", err)
}
} else {
conf, err := this.configure.GetPrivilegeCard(v.CId)
if err != nil {
return nil
}
privilegeID = append(privilegeID, v.PrivilegeID...)
// 检查 每日奖励是否发放
if !utils.IsToday(v.RewardTime) {
@ -246,14 +250,14 @@ func (this *Privilege) QueryPrivilege(session comm.IUserSession) (privilegeID []
// 检查离上次领奖过去几天
dt := configure.Now().Unix() - utils.GetZeroTime(v.RewardTime)
count := dt / (24 * 3600)
this.SendDailyMail(session, v.CId, int32(count+1))
this.SendDailyMail(session, v.CId, int32(count+1), conf.PType)
}
}
}
return
}
func (this *Privilege) SendDailyMail(session comm.IUserSession, cId string, count int32) {
func (this *Privilege) SendDailyMail(session comm.IUserSession, cId string, count int32, pType int32) {
conf, err := this.configure.GetPrivilegeCard(cId)
if err != nil {
return
@ -283,6 +287,11 @@ func (this *Privilege) SendDailyMail(session comm.IUserSession, cId string, coun
Cid: "",
Param: []string{},
}
if pType == 1 {
mail.Cid = comm.Yueka_1
} 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)

View File

@ -12,6 +12,7 @@ import "errors"
type GamePrivilegeCardData struct {
Id string
PType int32
Name string
AssertDay int32
RenewDay int32
@ -28,6 +29,7 @@ func (*GamePrivilegeCardData) GetTypeId() int32 {
func (_v *GamePrivilegeCardData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; if _v.Id, _ok_ = _buf["id"].(string); !_ok_ { err = errors.New("id error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["pType"].(float64); !_ok_ { err = errors.New("pType error"); return }; _v.PType = int32(_tempNum_) }
{ var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["assert_day"].(float64); !_ok_ { err = errors.New("assert_day error"); return }; _v.AssertDay = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["renew_day"].(float64); !_ok_ { err = errors.New("renew_day error"); return }; _v.RenewDay = int32(_tempNum_) }