diff --git a/modules/uigame/module.go b/modules/uigame/module.go index 8024c1781..9149502c0 100644 --- a/modules/uigame/module.go +++ b/modules/uigame/module.go @@ -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)