每日奖励优化
This commit is contained in:
parent
7cfe55f66b
commit
f1b4b58460
@ -226,7 +226,7 @@ func (this *Privilege) CheckPrivilege(session comm.IUserSession, cId string) boo
|
||||
|
||||
// 检查特权 并发送每日邮件
|
||||
func (this *Privilege) CheckDailyPrivilegeMail(session comm.IUserSession) {
|
||||
privilgeList, err := this.modelVip.getVipList(session.GetUserId())
|
||||
vipList, err := this.modelVip.getVipList(session.GetUserId())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@ -246,7 +246,7 @@ func (this *Privilege) CheckDailyPrivilegeMail(session comm.IUserSession) {
|
||||
data := this.configure.GetPrivilegeData(id)
|
||||
if data != nil {
|
||||
|
||||
if v, ok := privilgeList.Privilege[data.PrivilegeType]; ok {
|
||||
if v, ok := vipList.Privilege[data.PrivilegeType]; ok {
|
||||
|
||||
for i, v1 := range v.PrivilegeID {
|
||||
if v1 == id {
|
||||
@ -257,7 +257,7 @@ func (this *Privilege) CheckDailyPrivilegeMail(session comm.IUserSession) {
|
||||
}
|
||||
}
|
||||
}
|
||||
update["privilege"] = privilgeList.Privilege
|
||||
update["privilege"] = vipList.Privilege
|
||||
this.modelVip.modifyVipData(session.GetUserId(), update) // 更新数据
|
||||
} else {
|
||||
// 检查 每日奖励是否发放
|
||||
@ -273,13 +273,20 @@ func (this *Privilege) CheckDailyPrivilegeMail(session comm.IUserSession) {
|
||||
dt := configure.Now().Unix() - utils.GetZeroTime(v.RewardTime)
|
||||
count := dt / (24 * 3600)
|
||||
this.SendDailyMail(session, v.CId, int32(count+1), conf.PType)
|
||||
// 找特权类型为1的
|
||||
listVip, err := this.modelVip.getVipList(session.GetUserId())
|
||||
if err == nil {
|
||||
if v, ok := listVip.Privilege[comm.PrivilegeType1]; ok {
|
||||
|
||||
}
|
||||
}
|
||||
if !utils.IsToday(v.RewardTime) {
|
||||
// 每日奖励
|
||||
if v, ok := vipList.Privilege[comm.PrivilegeType1]; ok {
|
||||
this.SendDailyPrivilegeMail(session, v.PrivilegeID)
|
||||
}
|
||||
}
|
||||
vipList.RewardTime = configure.Now().Unix()
|
||||
if err = this.modelVip.Change(session.GetUserId(), map[string]interface{}{
|
||||
"rewardTime": v.RewardTime,
|
||||
}); err != nil {
|
||||
this.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user