游戏名模糊查询;特殊游戏rtp控制

dev_aagame_provider
zhora 4 weeks ago
parent f502e7b4b3
commit 280202e520
  1. 20
      call/config.go
  2. 2
      call/user.go
  3. 10
      modules/web/handler/game.go
  4. 27
      modules/web/providers/sn/handler.go
  5. 1
      modules/web/values/firstpage.go
  6. 1
      modules/web/values/game.go

@ -2218,6 +2218,26 @@ func GetGameListByTags(tagIds []int) (result []*common.ConfigGameList) {
return result
}
func GetGameListByName(gameList []*common.ConfigGameList, gameName string) (result []*common.ConfigGameList) {
gameNameLower := strings.ToLower(gameName)
gameNameLower = strings.ReplaceAll(gameNameLower, " ", "")
gameListAll := gameList
if len(gameListAll) == 0 {
gameListAll = configGameListAll
}
for _, v := range gameListAll {
tmpGameName := strings.ToLower(v.Name)
tmpGameName = strings.ReplaceAll(tmpGameName, " ", "")
if strings.Contains(tmpGameName, gameNameLower) {
result = append(result, v)
}
}
sort.Slice(result, func(i, j int) bool {
return result[i].Sort > result[j].Sort
})
return result
}
func GetConfigGameListByCode(provider int, gameCode string) *common.ConfigGameList {
for _, v := range configGameListAll {
if v.GameProvider == provider && v.GameCode == gameCode {

@ -738,6 +738,7 @@ func AddGameRecord(uid int, provider int, gameId int) error {
member := fmt.Sprintf("%v_%v", provider, gameId)
playerGamesSetKey := fmt.Sprintf("player:%v:games:set", uid)
playerGamesListKey := fmt.Sprintf("player:%v:games:list", uid)
playerGamesAt := fmt.Sprintf("player:%v:games:at", uid)
ctx := context.Background()
client := db.Redis().GetRedis()
// 检查集合中是否已经存在该游戏记录
@ -746,6 +747,7 @@ func AddGameRecord(uid int, provider int, gameId int) error {
return err
}
if !exists {
client.Set(ctx, playerGamesAt, member, 0)
// 将游戏ID添加到集合进行去重
client.SAdd(ctx, playerGamesSetKey, member)
// 将游戏ID添加到列表的头部

@ -158,8 +158,15 @@ func GameListNew(c *gin.Context) {
}
resp := &values.GameListNewResp{}
a.Data = resp
gameList := call.GetGameListByTags([]int{req.SubTagId})
var gameList []*common.ConfigGameList
if req.SubTagId > 0 {
gameList = call.GetGameListByTags([]int{req.SubTagId})
resp.Total = len(gameList)
}
if req.GameName != "" {
gameList = call.GetGameListByName(gameList, req.GameName)
resp.Total = len(gameList)
}
if resp.Total == 0 {
return
@ -178,6 +185,7 @@ func GameListNew(c *gin.Context) {
GameTag: gameTmp.Mark,
GameStatus: gameTmp.GameStatus,
GameIcon: gameTmp.Icon,
GameName: gameTmp.Name,
})
}
resp.List = list[start:end]

@ -1,6 +1,7 @@
package sn
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
@ -607,10 +608,34 @@ func GameControlCallback(c *gin.Context) {
}()
}
var controlGameId = []int{
23007913,
}
func checkSpecialControl(result string) bool {
if result == "" {
return false
}
for _, v := range controlGameId {
if result == fmt.Sprintf("%d_%d", common.ProviderSn, v) {
return true
}
}
return false
}
const specialControlRtp = 85
func Control(uid int, controlId int) error {
if controlId == 0 {
controlId = 1
}
rtp := call.GetRtpControlV1(uid)
result, _ := db.Redis().GetRedis().Get(context.Background(), fmt.Sprintf("player:%v:games:at", uid)).Result()
if rtp > specialControlRtp && checkSpecialControl(result) {
rtp = specialControlRtp
log.Debug("rtpControl special, uid:%d result:%s, rtp:%d", uid, result, specialControlRtp)
}
req := &ControlReq{
BaseReq: BaseReq{
SnAccount: SnAccount,
@ -624,7 +649,7 @@ func Control(uid int, controlId int) error {
TargetRtp int `json:"target_rtp"`
}{
{
TargetRtp: call.GetRtpControlV1(uid),
TargetRtp: rtp,
},
},
}

@ -37,6 +37,7 @@ type GameData struct {
GameTag int `json:"gameTag"` // 游戏标签(1:热门,2:最新,3:推荐)
GameStatus int `json:"gameStatus"` // 展示状态(1:上线,2:下线,3:维护中,4:即将上线)
GameIcon string `json:"gameIcon"` // 游戏图标
GameName string `json:"gameName"` // 游戏名称
}
type TagWithGameList struct {

@ -30,6 +30,7 @@ type GameTagResp struct {
type GameListNewReq struct {
TagId int `json:"tagId"` // 一级标签
SubTagId int `json:"subTagId"` // 二级标签
GameName string `json:"gameName"` // 游戏名称(模糊匹配)
Page int `json:"page"`
PageSize int `json:"pageSize"`
}

Loading…
Cancel
Save