七日签到奖励bug修复
This commit is contained in:
parent
ff3c6468cf
commit
53c573d7e0
@ -5,7 +5,9 @@ import (
|
|||||||
"server/game/mod/item"
|
"server/game/mod/item"
|
||||||
"server/gamedata"
|
"server/gamedata"
|
||||||
"server/pkg/github.com/name5566/leaf/log"
|
"server/pkg/github.com/name5566/leaf/log"
|
||||||
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -93,10 +95,23 @@ func GetSevenLoginJackpot(IsMonth int) []*gamedata.SevenLoginJackpotData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetMonthActive(Id int) int {
|
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 {
|
if err != nil {
|
||||||
log.Debug("GetSevenLoginReward err:%v", err)
|
log.Debug("GetSevenLoginReward err:%v", err)
|
||||||
return int(math.Inf(1))
|
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
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user