From 5c7c0ca3683c40bc8c41858aafbd23de69c9697b Mon Sep 17 00:00:00 2001 From: hahwu <31872165+hahwu@users.noreply.github.com> Date: Thu, 12 Mar 2026 19:57:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=83=E6=97=A5=E7=AD=BE=E5=88=B0=E5=A5=96?= =?UTF-8?q?=E5=8A=B1bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../conf/seven_login/seven_login_cfg.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/server/conf/seven_login/seven_login_cfg.go b/src/server/conf/seven_login/seven_login_cfg.go index 8b464349..4e5d57b5 100644 --- a/src/server/conf/seven_login/seven_login_cfg.go +++ b/src/server/conf/seven_login/seven_login_cfg.go @@ -5,7 +5,9 @@ import ( "server/game/mod/item" "server/gamedata" "server/pkg/github.com/name5566/leaf/log" + "sort" "strconv" + "time" ) const ( @@ -93,10 +95,23 @@ func GetSevenLoginJackpot(IsMonth int) []*gamedata.SevenLoginJackpotData { } func GetMonthActive(Id int) int { - data, err := gamedata.GetDataByIntKey(CFG_SEVEN_LOGIN_MONTH, Id) + month := int(time.Now().Month()) + data, err := gamedata.GetData(CFG_SEVEN_LOGIN_MONTH) + active := []int{} if err != nil { log.Debug("GetSevenLoginReward err:%v", err) return int(math.Inf(1)) } - return gamedata.GetIntValue(data, "Active") + for _, v := range data { + if gamedata.GetIntValue(v, "Month") == month { + active = append(active, gamedata.GetIntValue(v, "Active")) + } + } + sort.Ints(active) + if Id-1 < 0 || Id-1 >= len(active) { + log.Debug("GetSevenLoginReward err:%v", err) + return int(math.Inf(1)) + } + id := active[Id-1] + return id }