七日签到奖励bug修复

This commit is contained in:
hahwu 2026-03-12 19:57:14 +08:00
parent bb035e974a
commit 5c7c0ca368

View File

@ -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
}