游戏列表

pull/1/head
mofangmin 1 year ago
parent 74de848883
commit 76f8c2faf0
  1. 1
      call/config.go
  2. 11
      call/game.go
  3. 1
      modules/web/handler/firstpage.go
  4. 1
      modules/web/handler/game.go

@ -711,7 +711,6 @@ func GetConfigGameList(num int, cond ...int) []*common.ConfigGameList {
return ret
}
}
GetGameInfo(ret)
return ret
}

@ -65,10 +65,12 @@ func GetGameInfo(gameInfos []*common.ConfigGameList) {
}
cmds, err := pipeline.Exec(ctx)
now := time.Now()
for i := 0; i < 2*len(gameInfos); i = i + 2 {
game := gameInfos[i/2]
fieldNum := 3
for i := 0; i < fieldNum*len(gameInfos); i = i + fieldNum {
game := gameInfos[i/fieldNum]
maxRewardCmd := cmds[i]
maxRewardTimeCmd := cmds[i+1]
rtpCmd := cmds[i+2]
key := fmt.Sprintf("firstpage:games:%d_%d", game.GameProvider, game.GameID)
game.MaxReward, err = maxRewardCmd.(*redis.StringCmd).Int64()
if errors.Is(err, redis.Nil) {
@ -78,15 +80,18 @@ func GetGameInfo(gameInfos []*common.ConfigGameList) {
game.MaxReward = val
pipeline.HSet(ctx, key, maxRewardField, val, maxRewardTimeField, time.Now(), rtpField, rtp)
} else {
rtp, _ := rtpCmd.(*redis.StringCmd).Int64()
maxRewardTime, _ := maxRewardTimeCmd.(*redis.StringCmd).Time()
if now.Sub(maxRewardTime).Hours() >= 1 {
val := util.RandBetween64(game.MaxReward, 9999)
rtp := util.RandBetween64(93, 104)
rtp = util.RandBetween64(93, 104)
game.RTP = rtp
game.MaxReward = val
pipeline.HSet(ctx, key, maxRewardField, val, maxRewardTimeField, time.Now(), rtpField, rtp)
}
game.RTP = rtp
}
game.MaxReward *= common.DecimalDigits
}
_, err = pipeline.Exec(ctx)
if err != nil {

@ -68,6 +68,7 @@ func FirstPage(c *gin.Context) {
one.List = call.GetConfigGameList(req.GameNum, 0, v.JumpID)
}
}
call.GetGameInfo(one.List)
resp.Games = append(resp.Games, one)
}
for i := common.CurrencyTypeZero + 1; i < common.CurrencyAll; i++ {

@ -60,6 +60,7 @@ func GameList(c *gin.Context) {
end = len(list)
}
resp.List = list[start:end]
call.GetGameInfo(resp.List)
for _, v := range resp.List {
v.Jackpot = call.GetJackpot(common.JackpotTypeGame, v.GameID)
}

Loading…
Cancel
Save