diff --git a/bin/json/game_privilegecard.json b/bin/json/game_privilegecard.json index a640f6cc0..c08835790 100644 --- a/bin/json/game_privilegecard.json +++ b/bin/json/game_privilegecard.json @@ -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, diff --git a/comm/const.go b/comm/const.go index 53ebb322c..2cc51d6b9 100644 --- a/comm/const.go +++ b/comm/const.go @@ -469,3 +469,9 @@ const ( TrollSurprise //惊喜货物售价系数 ) + +// 邮件ID +const ( + Yueka_1 string = "Activity_PrivilegeCardDailyReward_lv1" + Yueka_2 string = "Activity_PrivilegeCardDailyReward_lv2" +) diff --git a/modules/privilege/module.go b/modules/privilege/module.go index 5e3b22763..d84fe7ff8 100644 --- a/modules/privilege/module.go +++ b/modules/privilege/module.go @@ -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) diff --git a/sys/configure/structs/Game.PrivilegeCardData.go b/sys/configure/structs/Game.PrivilegeCardData.go index 76b9c4793..917294a21 100644 --- a/sys/configure/structs/Game.PrivilegeCardData.go +++ b/sys/configure/structs/Game.PrivilegeCardData.go @@ -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_) }