清除非本日获得的碎片数据

This commit is contained in:
meixiongfeng 2023-08-09 15:39:16 +08:00
parent 1f0645a4cf
commit a8ab4be054

View File

@ -7,6 +7,7 @@ import (
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
"go_dreamfactory/utils"
"go_dreamfactory/modules"
)
@ -51,9 +52,17 @@ func (this *UiGame) HDPSTodayConsum(uid string, ps int32) {
activity := this.ModuleActivity.GetAllHdInfo()
curTime := configure.Now().Unix()
if v, ok := activity[pb.HdType_HdPuzzle]; ok { // 拼图小游戏
if v.Stime >= curTime && curTime <= v.Etime { // 活动时间范围内
if v.Stime <= curTime && curTime <= v.Etime { // 活动时间范围内
if rst, err := this.modelPuzzle.getPuzzleList(uid, v.Id); err == nil {
if conf, err := this.configure.GetPuzzleConsumConf(); err != nil {
if conf, err := this.configure.GetPuzzleConsumConf(); err == nil {
update := make(map[string]interface{})
// 清除每日获得的碎片数据
if !utils.IsToday(rst.Lasttime) {
rst.Lasttime = configure.Now().Unix()
rst.Val = 0
update["val"] = rst.Val
update["lasttime"] = rst.Lasttime
}
if conf.Getmax > rst.Val { // 超过今日上限
tmp := ps / conf.Usepawer
if tmp > rst.Val {
@ -74,7 +83,6 @@ func (this *UiGame) HDPSTodayConsum(uid string, ps int32) {
this.DispenseRes(s, []*cfg.Gameatn{res}, true)
}
update := make(map[string]interface{})
update["val"] = rst.Val
this.modelPuzzle.modifyPuzzleListByObjId(uid, update)