每日奖励优化

This commit is contained in:
meixiongfeng 2022-12-16 14:32:29 +08:00
parent 7cfe55f66b
commit f1b4b58460

View File

@ -226,7 +226,7 @@ func (this *Privilege) CheckPrivilege(session comm.IUserSession, cId string) boo
// 检查特权 并发送每日邮件 // 检查特权 并发送每日邮件
func (this *Privilege) CheckDailyPrivilegeMail(session comm.IUserSession) { func (this *Privilege) CheckDailyPrivilegeMail(session comm.IUserSession) {
privilgeList, err := this.modelVip.getVipList(session.GetUserId()) vipList, err := this.modelVip.getVipList(session.GetUserId())
if err != nil { if err != nil {
return return
} }
@ -246,7 +246,7 @@ func (this *Privilege) CheckDailyPrivilegeMail(session comm.IUserSession) {
data := this.configure.GetPrivilegeData(id) data := this.configure.GetPrivilegeData(id)
if data != nil { 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 { for i, v1 := range v.PrivilegeID {
if v1 == id { 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) // 更新数据 this.modelVip.modifyVipData(session.GetUserId(), update) // 更新数据
} else { } else {
// 检查 每日奖励是否发放 // 检查 每日奖励是否发放
@ -273,13 +273,20 @@ func (this *Privilege) CheckDailyPrivilegeMail(session comm.IUserSession) {
dt := configure.Now().Unix() - utils.GetZeroTime(v.RewardTime) dt := configure.Now().Unix() - utils.GetZeroTime(v.RewardTime)
count := dt / (24 * 3600) count := dt / (24 * 3600)
this.SendDailyMail(session, v.CId, int32(count+1), conf.PType) 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) {
this.SendDailyPrivilegeMail(session, v.PrivilegeID) // 每日奖励
} 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
} }
} }
} }