改计时器配置

This commit is contained in:
wh_zcy 2023-01-14 18:46:43 +08:00
parent 6373c1cf0c
commit 7113d791f6

View File

@ -23,7 +23,7 @@ import (
var ( var (
BOSS_SPORTS = "sports" BOSS_SPORTS = "sports"
BOSS_RANK = "rank" BOSS_RANK = "rank"
SPORTS_HOUR = 10 //赛季周期 SPORTS_HOUR = 3 * 24 //赛季周期
) )
type ModelSociatyBoss struct { type ModelSociatyBoss struct {
@ -112,8 +112,8 @@ func (s *ModelSociatyBoss) updateSociatyBossSports(data map[string]interface{})
// 赛季时间 // 赛季时间
func (s *ModelSociatyBoss) sportsTime() (t1, t2 int64) { func (s *ModelSociatyBoss) sportsTime() (t1, t2 int64) {
now := configure.Now() now := configure.Now()
end1 := now.Add(time.Duration(SPORTS_HOUR) * time.Minute) //测试时单位分钟 else Hour end1 := now.Add(time.Duration(SPORTS_HOUR) * time.Hour) //测试时单位分钟 else Hour
h, _ := time.ParseDuration("-2m") //测试时-2m else -1h h, _ := time.ParseDuration("-1h") //测试时-2m else -1h
end2 := end1.Add(h) end2 := end1.Add(h)
return end1.Unix(), end2.Unix() return end1.Unix(), end2.Unix()
} }
@ -431,7 +431,6 @@ func (s *ModelSociatyBoss) IsSports(uid string) bool {
// 赛季结算 // 赛季结算
func (s *ModelSociatyBoss) settlement() error { func (s *ModelSociatyBoss) settlement() error {
start := time.Now()
sports := s.getSociatyBossSports() sports := s.getSociatyBossSports()
if sports == nil { if sports == nil {
return errors.New("sociatyboss sports is nil") return errors.New("sociatyboss sports is nil")
@ -469,7 +468,7 @@ func (s *ModelSociatyBoss) settlement() error {
//将玩家积分加入排行榜 //将玩家积分加入排行榜
s.addRank(uid, total) s.addRank(uid, total)
s.moduleSociaty.Debug("结算:", log.Field{Key: "uid", Value: uid}, log.Field{Key: "耗时", Value: time.Since(start)}) s.moduleSociaty.Debug("结算:", log.Field{Key: "uid", Value: uid})
} }
return nil return nil