Commit 271b3b29efb583573599558d12a2149db47e564c

Authored by 王家文
1 parent 65274983
Exists in master and in 1 other branch dev-wjw

feat✨:房间排行活动配置

configs/conf-api.go 0 → 100644
@@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
  1 +package configs
  2 +
  3 +import (
  4 + "apigame/service-common/svconst"
  5 + "apigame/service-common/svmysql"
  6 + "apigame/service-common/svredis"
  7 + "fmt"
  8 +)
  9 +
  10 +// ApiGameConfig api游戏配置
  11 +type ApiGameConfig struct {
  12 + AppId string `gorm:"column:appid"`
  13 + GameId string `gorm:"column:gameid"`
  14 + Secret string `gorm:"column:secret"`
  15 + AppKey string `gorm:"column:appkey"`
  16 + Name string `gorm:"column:name"`
  17 +}
  18 +
  19 +func (c *ApiGameConfig) RedisInfo(suffix string) *svredis.RedisInfo {
  20 + tableName := "s_game_config"
  21 + return &svredis.RedisInfo{
  22 + CacheKey: fmt.Sprintf("%s:%s:%s", svconst.REDIS_CACHEP_REFIX, tableName, suffix),
  23 + CacheTime: 300,
  24 + }
  25 +}
  26 +
  27 +func (c *ApiGameConfig) MysqlInfo(suffix string) *svmysql.MysqlInfo {
  28 + tableName := "s_game_config"
  29 + return &svmysql.MysqlInfo{
  30 + DbMysql: svconst.DbApi.Where("gameid = ?", suffix),
  31 + TableName: tableName,
  32 + }
  33 +}
configs/conf-cardholder-decode.go 0 → 100644
@@ -0,0 +1,169 @@ @@ -0,0 +1,169 @@
  1 +package configs
  2 +
  3 +import (
  4 + "apigame/util/util-lx/lxalilog"
  5 + "encoding/json"
  6 + "errors"
  7 + "fmt"
  8 + "strings"
  9 +)
  10 +
  11 +// Decode 解析配置原始数据
  12 +func (c *CardActivityConfig) Decode(gameId string, configRaw *CardActivityConfigRaw) {
  13 + c.GameId = gameId
  14 + c.Raw = configRaw
  15 +
  16 + c.Id = configRaw.Id
  17 + c.OpenLevel = configRaw.OpenLevel
  18 + c.PreviewTime = configRaw.PreviewTime
  19 + c.StartTime = configRaw.StartTime
  20 + c.EndTime = configRaw.EndTime
  21 + c.Round = configRaw.Round
  22 +
  23 + c.Awards = make(map[string]string)
  24 + c.AlbumConfig = make(map[int]AlbumConfig)
  25 + c.CardConfig = make(map[int]CardConfig)
  26 + c.CardholderConfig = make(map[string]OpenCardholderConfig)
  27 + c.NormalCardStarConfig = make(map[string]NormalCardStarConfig)
  28 + c.CardSequenceConfig = make(map[string]CardSequenceConfig)
  29 + c.StarShopConfig = make(map[int]StarShopConfig)
  30 + // 解析奖励
  31 + {
  32 + err := json.Unmarshal([]byte(configRaw.Awards), &c.Awards)
  33 + if err != nil {
  34 + lxalilog.Errors(err, configRaw.Awards, gameId, configRaw.Id)
  35 + return
  36 + }
  37 + }
  38 + // 卡组配置
  39 + {
  40 + configs := make([]AlbumConfig, 0)
  41 + err := json.Unmarshal([]byte(configRaw.AlbumConfig), &configs)
  42 + if err != nil {
  43 + lxalilog.Errors(err, configRaw.AlbumConfig, gameId, configRaw.Id)
  44 + return
  45 + }
  46 + for _, i2 := range configs {
  47 + c.AlbumConfig[i2.SetId] = i2
  48 + }
  49 + }
  50 + // 卡牌配置
  51 + {
  52 + configs := make([]CardConfig, 0)
  53 + err := json.Unmarshal([]byte(configRaw.CardConfig), &configs)
  54 + if err != nil {
  55 + lxalilog.Errors(err, configRaw.CardConfig, gameId, configRaw.Id)
  56 + return
  57 + }
  58 + for _, i2 := range configs {
  59 + c.CardConfig[i2.Id] = i2
  60 + }
  61 + }
  62 + // 卡包开卡规则
  63 + {
  64 + configs := make([]OpenCardholderConfig, 0)
  65 + err := json.Unmarshal([]byte(configRaw.CardHolderConfig), &configs)
  66 + if err != nil {
  67 + lxalilog.Errors(err, configRaw.CardHolderConfig, gameId, configRaw.Id)
  68 + return
  69 + }
  70 + for _, i2 := range configs {
  71 + c.CardholderConfig[i2.Id] = i2
  72 + }
  73 + }
  74 + // 卡片星级配置
  75 + {
  76 + configs := make([]NormalCardStarConfig, 0)
  77 + err := json.Unmarshal([]byte(configRaw.NormalCardStarSequence), &configs)
  78 + if err != nil {
  79 + lxalilog.Errors(err, configRaw.NormalCardStarSequence, gameId, configRaw.Id)
  80 + return
  81 + }
  82 + for _, i2 := range configs {
  83 + i2.NormalCardSequenceIds = strings.Split(i2.NormalCardSequenceId, ",")
  84 + combineId := CombineIdSequenceIdCohort(i2.Id, i2.SequenceId, i2.Cohort)
  85 + c.NormalCardStarConfig[combineId] = i2
  86 + }
  87 + }
  88 + // 卡片星级对应卡牌配置
  89 + {
  90 + configs := make([]CardSequenceConfig, 0)
  91 + err := json.Unmarshal([]byte(configRaw.CardSequenceConfig), &configs)
  92 + if err != nil {
  93 + lxalilog.Errors(err, configRaw.CardSequenceConfig, gameId, configRaw.Id)
  94 + return
  95 + }
  96 + for _, i2 := range configs {
  97 + i2.CardIdLists = strings.Split(i2.CardIdList, ",")
  98 + combineId := CombineIdSequenceIdCohort(i2.Id, i2.SequenceId, i2.Cohort)
  99 + c.CardSequenceConfig[combineId] = i2
  100 + }
  101 + }
  102 + // 星星商店配置
  103 + {
  104 + configs := make([]StarShopConfig, 0)
  105 + err := json.Unmarshal([]byte(configRaw.StarShopConfig), &configs)
  106 + if err != nil {
  107 + lxalilog.Errors(err, configRaw.StarShopConfig, gameId, configRaw.Id)
  108 + return
  109 + }
  110 + for _, i2 := range configs {
  111 + c.StarShopConfig[i2.Id] = i2
  112 + }
  113 + }
  114 +
  115 + c.GenerateConfigClient()
  116 +}
  117 +
  118 +// GenerateConfigClient 生成给客户端的配置
  119 +func (c *CardActivityConfig) GenerateConfigClient() {
  120 + configClient := &CardActivityConfigClient{
  121 + Id: c.Id,
  122 + RoundAwards: c.Awards,
  123 + Albums: make([]AlbumConfig, 0),
  124 + Cards: make([]CardConfig, 0),
  125 + Holders: make([]OpenCardholderConfig, 0),
  126 + StarShop: make([]StarShopConfig, 0),
  127 + }
  128 + for _, i2 := range c.AlbumConfig {
  129 + configClient.Albums = append(configClient.Albums, i2)
  130 + }
  131 + for _, i2 := range c.CardConfig {
  132 + configClient.Cards = append(configClient.Cards, i2)
  133 + }
  134 + for _, i2 := range c.CardholderConfig {
  135 + configClient.Holders = append(configClient.Holders, i2)
  136 + }
  137 + for _, i2 := range c.StarShopConfig {
  138 + configClient.StarShop = append(configClient.StarShop, i2)
  139 + }
  140 + c.Client = configClient
  141 +}
  142 +
  143 +// CombineIdSequenceIdCohort 组合ID k=ID_用户序列_用户分组
  144 +func CombineIdSequenceIdCohort(id, sequenceId, cohort string) string {
  145 + return fmt.Sprintf("%s_%s_%s", id, sequenceId, cohort)
  146 +}
  147 +
  148 +// FindNormalCardStarConfig 查找配置 非保底卡星级ID
  149 +func (c *CardActivityConfig) FindNormalCardStarConfig(id, sequenceId, cohort string) (conf NormalCardStarConfig, has bool) {
  150 + combineId := CombineIdSequenceIdCohort(id, sequenceId, cohort)
  151 + conf, has = c.NormalCardStarConfig[combineId]
  152 + if !has {
  153 + lxalilog.Errors(errors.New("ht_cardholder NormalCardStarConfig error"), id, sequenceId, cohort)
  154 + }
  155 + return
  156 +}
  157 +
  158 +// FindCardSequenceConfig 查找配置 星级ID对应的卡片
  159 +func (c *CardActivityConfig) FindCardSequenceConfig(id, sequenceId, cohort string) (conf CardSequenceConfig, has bool) {
  160 + combineId := CombineIdSequenceIdCohort(id, sequenceId, cohort)
  161 + conf, has = c.CardSequenceConfig[combineId]
  162 + if !has {
  163 + lxalilog.Errors(errors.New("ht_cardholder CardSequenceConfig error"), id, sequenceId, cohort)
  164 + fmt.Println(id)
  165 + fmt.Println(sequenceId)
  166 + fmt.Println(cohort)
  167 + }
  168 + return
  169 +}
configs/conf-cardholder.go 0 → 100644
@@ -0,0 +1,137 @@ @@ -0,0 +1,137 @@
  1 +package configs
  2 +
  3 +import (
  4 + "apigame/service-common/svconst"
  5 + "apigame/service-common/svmysql"
  6 + "apigame/service-common/svredis"
  7 + "fmt"
  8 +)
  9 +
  10 +// CardActivityConfig 卡牌活动配置 分析后数据
  11 +type CardActivityConfig struct {
  12 + Raw *CardActivityConfigRaw `json:"-"`
  13 +
  14 + Id int64 // ID
  15 + OpenLevel int // 开启等级
  16 + PreviewTime int64 // 预告时间
  17 + StartTime int64 // 开始时间
  18 + EndTime int64 // 结束时间
  19 + Round int // 轮数
  20 +
  21 + Awards map[string]string // 奖励配置
  22 + AlbumConfig map[int]AlbumConfig // 卡组配置
  23 + CardConfig map[int]CardConfig // 卡牌配置
  24 + CardholderConfig map[string]OpenCardholderConfig // 卡包开卡规则
  25 + NormalCardStarConfig map[string]NormalCardStarConfig // k=ID_用户序列_用户分组 卡片星级配置
  26 + CardSequenceConfig map[string]CardSequenceConfig // k=ID_用户序列_用户分组 卡片星级对应卡牌配置
  27 + StarShopConfig map[int]StarShopConfig // 星星商店配置
  28 +
  29 + Client *CardActivityConfigClient
  30 + GameId string // 所属游戏ID
  31 +}
  32 +
  33 +func (c *CardActivityConfig) RedisInfo(suffix string) *svredis.RedisInfo {
  34 + tableName := svconst.MYSQL_TABLE_S_CARDHOLDER_CONFIG
  35 + return &svredis.RedisInfo{
  36 + CacheKey: fmt.Sprintf("%s:%s:%s", svconst.REDIS_CACHEP_REFIX, tableName, suffix),
  37 + CacheTime: 300,
  38 + }
  39 +}
  40 +
  41 +// CardActivityConfigRaw 卡牌活动配置 原始数据
  42 +type CardActivityConfigRaw struct {
  43 + Id int64 // ID
  44 + OpenLevel int // 开启等级
  45 + PreviewTime int64 // 预告时间
  46 + StartTime int64 // 开始时间
  47 + EndTime int64 // 结束时间
  48 + Round int // 轮数
  49 +
  50 + Awards string `json:"-"` // 奖励配置
  51 + AlbumConfig string `json:"-"` // 卡组配置
  52 + CardConfig string `json:"-"` // 卡牌配置
  53 + CardHolderConfig string `json:"-"` // 卡包开卡规则
  54 + NormalCardStarSequence string `json:"-"` // 卡片星级配置
  55 + CardSequenceConfig string `json:"-"` // 卡片星级对应卡牌配置
  56 + StarShopConfig string `json:"-"` // 星星商店配置
  57 +
  58 + Ver string // 版本号
  59 + Status int // 状态 0=关闭 1=开启
  60 + UpdateTime int64 // 修改时间戳
  61 +}
  62 +
  63 +func (c *CardActivityConfigRaw) MysqlInfo(suffix string) *svmysql.MysqlInfo {
  64 + tableName := svconst.MYSQL_TABLE_S_CARDHOLDER_CONFIG
  65 + return &svmysql.MysqlInfo{
  66 + DbMysql: svconst.DbConfig.Where("status = ?", 1),
  67 + TableName: fmt.Sprintf("%s_%s", tableName, suffix),
  68 + }
  69 +}
  70 +
  71 +// CardActivityConfigClient 卡牌活动配置 给客户端数据
  72 +type CardActivityConfigClient struct {
  73 + Id int64 `form:"id" json:"id"` // ID
  74 + RoundAwards map[string]string `form:"round_awards" json:"round_awards"` // 轮次奖励配置
  75 + Albums []AlbumConfig `form:"albums" json:"albums"` // 卡组配置
  76 + Cards []CardConfig `form:"cards" json:"cards"` // 卡牌配置
  77 + Holders []OpenCardholderConfig `form:"holders" json:"holders"` // 卡包开卡规则
  78 + StarShop []StarShopConfig `form:"star_shop" json:"star_shop"` // 星星商店配置
  79 +}
  80 +
  81 +// AlbumConfig 卡组表
  82 +type AlbumConfig struct {
  83 + SetId int `json:"set_id"` // 卡组名
  84 + Name int `json:"name"` // 卡组图片
  85 + Icon string `json:"icon"` // 卡组id
  86 + Rewards map[string]string `json:"rewards"` // 集齐奖励 k=轮次
  87 + StartTime int64 `json:"start_time"` // 开始时间
  88 + EndTime int64 `json:"end_time"` // 结束时间
  89 +}
  90 +
  91 +// CardConfig 卡牌表
  92 +type CardConfig struct {
  93 + Id int `json:"id"` // ID
  94 + Name int `json:"name"` // 卡牌名字
  95 + Icon int `json:"icon"` // 卡牌图标
  96 + Desc int `json:"desc"` // 卡牌描述
  97 + SetId int `json:"album_setid"` // 卡组id
  98 + Star int `json:"star"` // 星级
  99 + IsGold int `json:"is_gold"` // 是否是金卡
  100 + IsSend int `json:"is_send"` // 卡片是否可赠送
  101 +}
  102 +
  103 +// OpenCardholderConfig 卡包开卡规则表
  104 +type OpenCardholderConfig struct {
  105 + Id string `json:"id"` // ID
  106 + IsGoldCardholder int `json:"is_gold_card_holder"` // 是否是金卡包
  107 + IsNew int `json:"is_new"` // 是否是新卡包
  108 + GuaranteedStarCardId string `json:"guaranteed_star_card_id"` // 保底卡星级序列ID
  109 + NormalCardNumber int `json:"normal_card_number"` // 非保底卡数量
  110 + MinimumGuaranteeCardId string `json:"minimum_guarantee_card_id"` // 非保底卡牌序列ID
  111 + ActivityId int `json:"activity_id"` // 对应活动ID
  112 +}
  113 +
  114 +// NormalCardStarConfig 非保底卡星级ID
  115 +type NormalCardStarConfig struct {
  116 + Id string `json:"id"` // ID
  117 + SequenceId string `json:"user_sequence_id"` // 用户序列组ID
  118 + Cohort string `json:"cohort"` // 用户分组
  119 + NormalCardSequenceId string `json:"normal_card_sequence_id"` // 非保底星级序列
  120 + NormalCardSequenceIds []string `json:"normal_card_sequence_ids"` // 非保底星级序列
  121 +}
  122 +
  123 +// CardSequenceConfig 星级ID对应的卡片
  124 +type CardSequenceConfig struct {
  125 + Id string `json:"id"` // ID
  126 + SequenceId string `json:"user_sequence_id"` // 用户序列组ID
  127 + Cohort string `json:"cohort"` // 用户分组
  128 + CardIdList string `json:"card_id_list"` // 卡牌抽取序列
  129 + CardIdLists []string `json:"card_id_lists"` // 卡牌抽取序列
  130 +}
  131 +
  132 +// StarShopConfig 星星商店配置
  133 +type StarShopConfig struct {
  134 + Id int `json:"id"` // ID
  135 + NeedStarNumber int `json:"need_star_number"` // 需求星星数
  136 + CardBagIds []int `json:"card_bag_ids"` // 可换取的卡包ID {卡包类型,卡包ID,卡包数量}
  137 +}
configs/conf-roomrank-decode.go 0 → 100644
@@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
  1 +package configs
  2 +
  3 +import (
  4 + "apigame/util/util-lx/lxalilog"
  5 + "encoding/json"
  6 +)
  7 +
  8 +// Decode 解析配置原始数据
  9 +func (c *RoomRankConfig) Decode(gameId string, configRaw *RoomRankConfigRaw) {
  10 + c.GameId = gameId
  11 + c.Raw = configRaw
  12 +
  13 + c.Id = configRaw.Id
  14 + c.OpenLevel = configRaw.OpenLevel
  15 + c.PreviewTime = configRaw.PreviewTime
  16 + c.StartTime = configRaw.StartTime
  17 + c.EndTime = configRaw.EndTime
  18 +
  19 + c.Robot = make(map[int]RoomRankRobotConfig)
  20 +
  21 + // 解析机器人
  22 + {
  23 + configs := make([]RoomRankRobotConfig, 0)
  24 + err := json.Unmarshal([]byte(configRaw.Robot), &configs)
  25 + if err != nil {
  26 + lxalilog.Errors(err, configRaw.Robot, gameId, configRaw.Id)
  27 + return
  28 + }
  29 + for _, i2 := range configs {
  30 + c.Robot[i2.Id] = i2
  31 + }
  32 + }
  33 +
  34 + c.GenerateConfigClient()
  35 +}
  36 +
  37 +// GenerateConfigClient 生成给客户端的配置
  38 +func (c *RoomRankConfig) GenerateConfigClient() {
  39 + configClient := &RoomRankConfigClient{
  40 + Id: c.Id,
  41 + }
  42 + c.Client = configClient
  43 +}
configs/conf-roomrank.go 0 → 100644
@@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
  1 +package configs
  2 +
  3 +import (
  4 + "apigame/service-common/svconst"
  5 + "apigame/service-common/svmysql"
  6 + "apigame/service-common/svredis"
  7 + "fmt"
  8 +)
  9 +
  10 +// RoomRankConfig 房间排行活动配置 分析后数据
  11 +type RoomRankConfig struct {
  12 + Raw *RoomRankConfigRaw `json:"-"`
  13 +
  14 + Id int64 // ID
  15 + OpenLevel int // 开启等级
  16 + PreviewTime int64 // 预告时间
  17 + StartTime int64 // 开始时间
  18 + EndTime int64 // 结束时间
  19 +
  20 + Robot map[int]RoomRankRobotConfig // 机器人配置
  21 +
  22 + Client *RoomRankConfigClient
  23 + GameId string // 所属游戏ID
  24 +}
  25 +
  26 +func (c *RoomRankConfig) RedisInfo(suffix string) *svredis.RedisInfo {
  27 + tableName := svconst.MYSQL_TABLE_S_ROOMRANK_CONFIG
  28 + return &svredis.RedisInfo{
  29 + CacheKey: fmt.Sprintf("%s:%s:%s", svconst.REDIS_CACHEP_REFIX, tableName, suffix),
  30 + CacheTime: 300,
  31 + }
  32 +}
  33 +
  34 +// RoomRankConfigRaw 房间排行活动配置 原始数据
  35 +type RoomRankConfigRaw struct {
  36 + Id int64 // ID
  37 + OpenLevel int // 开启等级
  38 + PreviewTime int64 // 预告时间
  39 + StartTime int64 // 开始时间
  40 + EndTime int64 // 结束时间
  41 +
  42 + Robot string `json:"-"` // 机器人配置
  43 +
  44 + Ver string // 版本号
  45 + Status int // 状态 0=关闭 1=开启
  46 + UpdateTime int64 // 修改时间戳
  47 +}
  48 +
  49 +func (c *RoomRankConfigRaw) MysqlInfo(suffix string) *svmysql.MysqlInfo {
  50 + tableName := svconst.MYSQL_TABLE_S_ROOMRANK_CONFIG
  51 + return &svmysql.MysqlInfo{
  52 + DbMysql: svconst.DbConfig.Where("status = ?", 1),
  53 + TableName: tableName + suffix,
  54 + }
  55 +}
  56 +
  57 +// RoomRankConfigClient 房间排行活动配置 给客户端数据
  58 +type RoomRankConfigClient struct {
  59 + Id int64 `form:"id" json:"id"` // ID
  60 +}
  61 +
  62 +// RoomRankRobotConfig 机器人配置
  63 +type RoomRankRobotConfig struct {
  64 + Id int `json:"id"` // id
  65 + MinScore int `json:"min_score"` // 最低分数
  66 + TotalScore int `json:"total_score"` // 总分数
  67 + TotalRate int `json:"total_rate"` // 总分浮动范围(%)
  68 +}
configs/feat-api.go
@@ -1,33 +0,0 @@ @@ -1,33 +0,0 @@
1 -package configs  
2 -  
3 -import (  
4 - "apigame/service-common/svconst"  
5 - "apigame/service-common/svmysql"  
6 - "apigame/service-common/svredis"  
7 - "fmt"  
8 -)  
9 -  
10 -// ApiGameConfig api游戏配置  
11 -type ApiGameConfig struct {  
12 - AppId string `gorm:"column:appid"`  
13 - GameId string `gorm:"column:gameid"`  
14 - Secret string `gorm:"column:secret"`  
15 - AppKey string `gorm:"column:appkey"`  
16 - Name string `gorm:"column:name"`  
17 -}  
18 -  
19 -func (c *ApiGameConfig) RedisInfo(suffix string) *svredis.RedisInfo {  
20 - tableName := "s_game_config"  
21 - return &svredis.RedisInfo{  
22 - CacheKey: fmt.Sprintf("%s:%s:%s", svconst.REDIS_CACHEP_REFIX, tableName, suffix),  
23 - CacheTime: 300,  
24 - }  
25 -}  
26 -  
27 -func (c *ApiGameConfig) MysqlInfo(suffix string) *svmysql.MysqlInfo {  
28 - tableName := "s_game_config"  
29 - return &svmysql.MysqlInfo{  
30 - DbMysql: svconst.DbApi.Where("gameid = ?", suffix),  
31 - TableName: tableName,  
32 - }  
33 -}  
configs/feat-cardholder-decode.go
@@ -1,169 +0,0 @@ @@ -1,169 +0,0 @@
1 -package configs  
2 -  
3 -import (  
4 - "apigame/util/util-lx/lxalilog"  
5 - "encoding/json"  
6 - "errors"  
7 - "fmt"  
8 - "strings"  
9 -)  
10 -  
11 -// Decode 解析配置原始数据  
12 -func (c *CardActivityConfig) Decode(gameId string, configRaw *CardActivityConfigRaw) {  
13 - c.GameId = gameId  
14 - c.Raw = configRaw  
15 -  
16 - c.Id = configRaw.Id  
17 - c.OpenLevel = configRaw.OpenLevel  
18 - c.PreviewTime = configRaw.PreviewTime  
19 - c.StartTime = configRaw.StartTime  
20 - c.EndTime = configRaw.EndTime  
21 - c.Round = configRaw.Round  
22 -  
23 - c.Awards = make(map[string]string)  
24 - c.AlbumConfig = make(map[int]AlbumConfig)  
25 - c.CardConfig = make(map[int]CardConfig)  
26 - c.CardholderConfig = make(map[string]OpenCardholderConfig)  
27 - c.NormalCardStarConfig = make(map[string]NormalCardStarConfig)  
28 - c.CardSequenceConfig = make(map[string]CardSequenceConfig)  
29 - c.StarShopConfig = make(map[int]StarShopConfig)  
30 - // 解析奖励  
31 - {  
32 - err := json.Unmarshal([]byte(configRaw.Awards), &c.Awards)  
33 - if err != nil {  
34 - lxalilog.Errors(err, configRaw.Awards, gameId, configRaw.Id)  
35 - return  
36 - }  
37 - }  
38 - // 卡组配置  
39 - {  
40 - configs := make([]AlbumConfig, 0)  
41 - err := json.Unmarshal([]byte(configRaw.AlbumConfig), &configs)  
42 - if err != nil {  
43 - lxalilog.Errors(err, configRaw.AlbumConfig, gameId, configRaw.Id)  
44 - return  
45 - }  
46 - for _, i2 := range configs {  
47 - c.AlbumConfig[i2.SetId] = i2  
48 - }  
49 - }  
50 - // 卡牌配置  
51 - {  
52 - configs := make([]CardConfig, 0)  
53 - err := json.Unmarshal([]byte(configRaw.CardConfig), &configs)  
54 - if err != nil {  
55 - lxalilog.Errors(err, configRaw.CardConfig, gameId, configRaw.Id)  
56 - return  
57 - }  
58 - for _, i2 := range configs {  
59 - c.CardConfig[i2.Id] = i2  
60 - }  
61 - }  
62 - // 卡包开卡规则  
63 - {  
64 - configs := make([]OpenCardholderConfig, 0)  
65 - err := json.Unmarshal([]byte(configRaw.CardHolderConfig), &configs)  
66 - if err != nil {  
67 - lxalilog.Errors(err, configRaw.CardHolderConfig, gameId, configRaw.Id)  
68 - return  
69 - }  
70 - for _, i2 := range configs {  
71 - c.CardholderConfig[i2.Id] = i2  
72 - }  
73 - }  
74 - // 卡片星级配置  
75 - {  
76 - configs := make([]NormalCardStarConfig, 0)  
77 - err := json.Unmarshal([]byte(configRaw.NormalCardStarSequence), &configs)  
78 - if err != nil {  
79 - lxalilog.Errors(err, configRaw.NormalCardStarSequence, gameId, configRaw.Id)  
80 - return  
81 - }  
82 - for _, i2 := range configs {  
83 - i2.NormalCardSequenceIds = strings.Split(i2.NormalCardSequenceId, ",")  
84 - combineId := CombineIdSequenceIdCohort(i2.Id, i2.SequenceId, i2.Cohort)  
85 - c.NormalCardStarConfig[combineId] = i2  
86 - }  
87 - }  
88 - // 卡片星级对应卡牌配置  
89 - {  
90 - configs := make([]CardSequenceConfig, 0)  
91 - err := json.Unmarshal([]byte(configRaw.CardSequenceConfig), &configs)  
92 - if err != nil {  
93 - lxalilog.Errors(err, configRaw.CardSequenceConfig, gameId, configRaw.Id)  
94 - return  
95 - }  
96 - for _, i2 := range configs {  
97 - i2.CardIdLists = strings.Split(i2.CardIdList, ",")  
98 - combineId := CombineIdSequenceIdCohort(i2.Id, i2.SequenceId, i2.Cohort)  
99 - c.CardSequenceConfig[combineId] = i2  
100 - }  
101 - }  
102 - // 星星商店配置  
103 - {  
104 - configs := make([]StarShopConfig, 0)  
105 - err := json.Unmarshal([]byte(configRaw.StarShopConfig), &configs)  
106 - if err != nil {  
107 - lxalilog.Errors(err, configRaw.StarShopConfig, gameId, configRaw.Id)  
108 - return  
109 - }  
110 - for _, i2 := range configs {  
111 - c.StarShopConfig[i2.Id] = i2  
112 - }  
113 - }  
114 -  
115 - c.GenerateConfigClient()  
116 -}  
117 -  
118 -// GenerateConfigClient 生成给客户端的配置  
119 -func (c *CardActivityConfig) GenerateConfigClient() {  
120 - configClient := &CardActivityConfigClient{  
121 - Id: c.Id,  
122 - RoundAwards: c.Awards,  
123 - Albums: make([]AlbumConfig, 0),  
124 - Cards: make([]CardConfig, 0),  
125 - Holders: make([]OpenCardholderConfig, 0),  
126 - StarShop: make([]StarShopConfig, 0),  
127 - }  
128 - for _, i2 := range c.AlbumConfig {  
129 - configClient.Albums = append(configClient.Albums, i2)  
130 - }  
131 - for _, i2 := range c.CardConfig {  
132 - configClient.Cards = append(configClient.Cards, i2)  
133 - }  
134 - for _, i2 := range c.CardholderConfig {  
135 - configClient.Holders = append(configClient.Holders, i2)  
136 - }  
137 - for _, i2 := range c.StarShopConfig {  
138 - configClient.StarShop = append(configClient.StarShop, i2)  
139 - }  
140 - c.Client = configClient  
141 -}  
142 -  
143 -// CombineIdSequenceIdCohort 组合ID k=ID_用户序列_用户分组  
144 -func CombineIdSequenceIdCohort(id, sequenceId, cohort string) string {  
145 - return fmt.Sprintf("%s_%s_%s", id, sequenceId, cohort)  
146 -}  
147 -  
148 -// FindNormalCardStarConfig 查找配置 非保底卡星级ID  
149 -func (c *CardActivityConfig) FindNormalCardStarConfig(id, sequenceId, cohort string) (conf NormalCardStarConfig, has bool) {  
150 - combineId := CombineIdSequenceIdCohort(id, sequenceId, cohort)  
151 - conf, has = c.NormalCardStarConfig[combineId]  
152 - if !has {  
153 - lxalilog.Errors(errors.New("ht_cardholder NormalCardStarConfig error"), id, sequenceId, cohort)  
154 - }  
155 - return  
156 -}  
157 -  
158 -// FindCardSequenceConfig 查找配置 星级ID对应的卡片  
159 -func (c *CardActivityConfig) FindCardSequenceConfig(id, sequenceId, cohort string) (conf CardSequenceConfig, has bool) {  
160 - combineId := CombineIdSequenceIdCohort(id, sequenceId, cohort)  
161 - conf, has = c.CardSequenceConfig[combineId]  
162 - if !has {  
163 - lxalilog.Errors(errors.New("ht_cardholder CardSequenceConfig error"), id, sequenceId, cohort)  
164 - fmt.Println(id)  
165 - fmt.Println(sequenceId)  
166 - fmt.Println(cohort)  
167 - }  
168 - return  
169 -}  
configs/feat-cardholder.go
@@ -1,135 +0,0 @@ @@ -1,135 +0,0 @@
1 -package configs  
2 -  
3 -import (  
4 - "apigame/service-common/svconst"  
5 - "apigame/service-common/svmysql"  
6 - "apigame/service-common/svredis"  
7 - "fmt"  
8 -)  
9 -  
10 -// CardActivityConfig 卡牌活动配置 分析后数据  
11 -type CardActivityConfig struct {  
12 - Raw *CardActivityConfigRaw `json:"-"`  
13 -  
14 - Id int64 // ID  
15 - OpenLevel int // 开启等级  
16 - PreviewTime int64 // 预告时间  
17 - StartTime int64 // 开始时间  
18 - EndTime int64 // 结束时间  
19 - Round int // 轮数  
20 -  
21 - Awards map[string]string // 奖励配置  
22 - AlbumConfig map[int]AlbumConfig // 卡组配置  
23 - CardConfig map[int]CardConfig // 卡牌配置  
24 - CardholderConfig map[string]OpenCardholderConfig // 卡包开卡规则  
25 - NormalCardStarConfig map[string]NormalCardStarConfig // k=ID_用户序列_用户分组 卡片星级配置  
26 - CardSequenceConfig map[string]CardSequenceConfig // k=ID_用户序列_用户分组 卡片星级对应卡牌配置  
27 - StarShopConfig map[int]StarShopConfig // 星星商店配置  
28 -  
29 - Client *CardActivityConfigClient  
30 - GameId string // 所属游戏ID  
31 -}  
32 -  
33 -func (c *CardActivityConfig) RedisInfo(suffix string) *svredis.RedisInfo {  
34 - tableName := svconst.MYSQL_TABLE_S_CARDHOLDER_CONFIG  
35 - return &svredis.RedisInfo{  
36 - CacheKey: fmt.Sprintf("%s:%s:%s", svconst.REDIS_CACHEP_REFIX, tableName, suffix),  
37 - CacheTime: 300,  
38 - }  
39 -}  
40 -  
41 -// CardActivityConfigRaw 卡牌活动配置 原始数据  
42 -type CardActivityConfigRaw struct {  
43 - Id int64 // ID  
44 - OpenLevel int // 开启等级  
45 - PreviewTime int64 // 预告时间  
46 - StartTime int64 // 开始时间  
47 - EndTime int64 // 结束时间  
48 - Round int // 轮数  
49 - Awards string `json:"-"` // 奖励配置  
50 - AlbumConfig string `json:"-"` // 卡组配置  
51 - CardConfig string `json:"-"` // 卡牌配置  
52 - CardHolderConfig string `json:"-"` // 卡包开卡规则  
53 - NormalCardStarSequence string `json:"-"` // 卡片星级配置  
54 - CardSequenceConfig string `json:"-"` // 卡片星级对应卡牌配置  
55 - StarShopConfig string `json:"-"` // 星星商店配置  
56 - Ver string // 版本号  
57 - Status int // 状态 0=关闭 1=开启  
58 - UpdateTime int64 // 修改时间戳  
59 -}  
60 -  
61 -func (c *CardActivityConfigRaw) MysqlInfo(suffix string) *svmysql.MysqlInfo {  
62 - tableName := svconst.MYSQL_TABLE_S_CARDHOLDER_CONFIG  
63 - return &svmysql.MysqlInfo{  
64 - DbMysql: svconst.DbConfig.Where("status = ?", 1),  
65 - TableName: tableName + suffix,  
66 - }  
67 -}  
68 -  
69 -// CardActivityConfigClient 卡牌活动配置 给客户端数据  
70 -type CardActivityConfigClient struct {  
71 - Id int64 `form:"id" json:"id"` // ID  
72 - RoundAwards map[string]string `form:"round_awards" json:"round_awards"` // 轮次奖励配置  
73 - Albums []AlbumConfig `form:"albums" json:"albums"` // 卡组配置  
74 - Cards []CardConfig `form:"cards" json:"cards"` // 卡牌配置  
75 - Holders []OpenCardholderConfig `form:"holders" json:"holders"` // 卡包开卡规则  
76 - StarShop []StarShopConfig `form:"star_shop" json:"star_shop"` // 星星商店配置  
77 -}  
78 -  
79 -// AlbumConfig 卡组表  
80 -type AlbumConfig struct {  
81 - SetId int `json:"set_id"` // 卡组名  
82 - Name int `json:"name"` // 卡组图片  
83 - Icon string `json:"icon"` // 卡组id  
84 - Rewards map[string]string `json:"rewards"` // 集齐奖励 k=轮次  
85 - StartTime int64 `json:"start_time"` // 开始时间  
86 - EndTime int64 `json:"end_time"` // 结束时间  
87 -}  
88 -  
89 -// CardConfig 卡牌表  
90 -type CardConfig struct {  
91 - Id int `json:"id"` // ID  
92 - Name int `json:"name"` // 卡牌名字  
93 - Icon int `json:"icon"` // 卡牌图标  
94 - Desc int `json:"desc"` // 卡牌描述  
95 - SetId int `json:"album_setid"` // 卡组id  
96 - Star int `json:"star"` // 星级  
97 - IsGold int `json:"is_gold"` // 是否是金卡  
98 - IsSend int `json:"is_send"` // 卡片是否可赠送  
99 -}  
100 -  
101 -// OpenCardholderConfig 卡包开卡规则表  
102 -type OpenCardholderConfig struct {  
103 - Id string `json:"id"` // ID  
104 - IsGoldCardholder int `json:"is_gold_card_holder"` // 是否是金卡包  
105 - IsNew int `json:"is_new"` // 是否是新卡包  
106 - GuaranteedStarCardId string `json:"guaranteed_star_card_id"` // 保底卡星级序列ID  
107 - NormalCardNumber int `json:"normal_card_number"` // 非保底卡数量  
108 - MinimumGuaranteeCardId string `json:"minimum_guarantee_card_id"` // 非保底卡牌序列ID  
109 - ActivityId int `json:"activity_id"` // 对应活动ID  
110 -}  
111 -  
112 -// NormalCardStarConfig 非保底卡星级ID  
113 -type NormalCardStarConfig struct {  
114 - Id string `json:"id"` // ID  
115 - SequenceId string `json:"user_sequence_id"` // 用户序列组ID  
116 - Cohort string `json:"cohort"` // 用户分组  
117 - NormalCardSequenceId string `json:"normal_card_sequence_id"` // 非保底星级序列  
118 - NormalCardSequenceIds []string `json:"normal_card_sequence_ids"` // 非保底星级序列  
119 -}  
120 -  
121 -// CardSequenceConfig 星级ID对应的卡片  
122 -type CardSequenceConfig struct {  
123 - Id string `json:"id"` // ID  
124 - SequenceId string `json:"user_sequence_id"` // 用户序列组ID  
125 - Cohort string `json:"cohort"` // 用户分组  
126 - CardIdList string `json:"card_id_list"` // 卡牌抽取序列  
127 - CardIdLists []string `json:"card_id_lists"` // 卡牌抽取序列  
128 -}  
129 -  
130 -// StarShopConfig 星星商店配置  
131 -type StarShopConfig struct {  
132 - Id int `json:"id"` // ID  
133 - NeedStarNumber int `json:"need_star_number"` // 需求星星数  
134 - CardBagIds []int `json:"card_bag_ids"` // 可换取的卡包ID {卡包类型,卡包ID,卡包数量}  
135 -}  
configs/feat-roomrank-decode.go
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -package configs  
2 -  
3 -// Decode 解析配置原始数据  
4 -func (c *RoomRankConfig) Decode(gameId string, configRaw *RoomRankConfigRaw) {  
5 - c.GameId = gameId  
6 - c.Raw = configRaw  
7 -  
8 - c.Id = configRaw.Id  
9 - // 解析奖励  
10 -  
11 - c.GenerateConfigClient()  
12 -}  
13 -  
14 -// GenerateConfigClient 生成给客户端的配置  
15 -func (c *RoomRankConfig) GenerateConfigClient() {  
16 - configClient := &RoomRankConfigClient{  
17 - Id: c.Id,  
18 - }  
19 - c.Client = configClient  
20 -}  
configs/feat-roomrank.go
@@ -1,51 +0,0 @@ @@ -1,51 +0,0 @@
1 -package configs  
2 -  
3 -import (  
4 - "apigame/service-common/svconst"  
5 - "apigame/service-common/svmysql"  
6 - "apigame/service-common/svredis"  
7 - "fmt"  
8 -)  
9 -  
10 -// RoomRankConfig 房间排行活动配置 分析后数据  
11 -type RoomRankConfig struct {  
12 - Raw *RoomRankConfigRaw `json:"-"`  
13 -  
14 - Id int64 // ID  
15 -  
16 - Client *RoomRankConfigClient  
17 - GameId string // 所属游戏ID  
18 -}  
19 -  
20 -func (c *RoomRankConfig) RedisInfo(suffix string) *svredis.RedisInfo {  
21 - tableName := svconst.MYSQL_TABLE_S_ROOMRANK_CONFIG  
22 - return &svredis.RedisInfo{  
23 - CacheKey: fmt.Sprintf("%s:%s:%s", svconst.REDIS_CACHEP_REFIX, tableName, suffix),  
24 - CacheTime: 300,  
25 - }  
26 -}  
27 -  
28 -// RoomRankConfigRaw 卡牌活动配置 原始数据  
29 -type RoomRankConfigRaw struct {  
30 - Id int64 // ID  
31 - OpenLevel int // 开启等级  
32 - PreviewTime int64 // 预告时间  
33 - StartTime int64 // 开始时间  
34 - EndTime int64 // 结束时间  
35 - Ver string // 版本号  
36 - Status int // 状态 0=关闭 1=开启  
37 - UpdateTime int64 // 修改时间戳  
38 -}  
39 -  
40 -func (c *RoomRankConfigRaw) MysqlInfo(suffix string) *svmysql.MysqlInfo {  
41 - tableName := svconst.MYSQL_TABLE_S_ROOMRANK_CONFIG  
42 - return &svmysql.MysqlInfo{  
43 - DbMysql: svconst.DbConfig.Where("status = ?", 1),  
44 - TableName: tableName + suffix,  
45 - }  
46 -}  
47 -  
48 -// RoomRankConfigClient 卡牌活动配置 给客户端数据  
49 -type RoomRankConfigClient struct {  
50 - Id int64 `form:"id" json:"id"` // ID  
51 -}  
configs/registry.go
@@ -79,6 +79,7 @@ func GetRoomRankConfig(gameId string) (conf *RoomRankConfig, has bool) { @@ -79,6 +79,7 @@ func GetRoomRankConfig(gameId string) (conf *RoomRankConfig, has bool) {
79 conf.Decode(gameId, confRaw) 79 conf.Decode(gameId, confRaw)
80 80
81 fmt.Println("dwjw GetRoomRankConfig save cache") 81 fmt.Println("dwjw GetRoomRankConfig save cache")
  82 + fmt.Println("dwjw🐸", conf.Robot)
82 svredis.SaveData(gameId, conf) 83 svredis.SaveData(gameId, conf)
83 84
84 return 85 return
controllers/demo.go
1 package controllers 1 package controllers
2 2
3 import ( 3 import (
  4 + "apigame/configs"
4 "apigame/models" 5 "apigame/models"
5 "apigame/service/code-msg" 6 "apigame/service/code-msg"
6 - "apigame/service/roomrank" 7 + "apigame/util/zjson"
7 "fmt" 8 "fmt"
8 ) 9 )
9 10
@@ -23,9 +24,26 @@ func (c *DemoController) Demo() { @@ -23,9 +24,26 @@ func (c *DemoController) Demo() {
23 fmt.Println("DemoController.demo") 24 fmt.Println("DemoController.demo")
24 25
25 { 26 {
26 - room := &roomrank.DataRoomRankRoom{Uid: req.UID, ActivityId: 1}  
27 - roomrank.SaveRoom(req.GameID, room)  
28 - fmt.Println(room.Id) 27 + list := make([]configs.RoomRankRobotConfig, 0)
  28 + list = append(list, configs.RoomRankRobotConfig{
  29 + Id: 1,
  30 + MinScore: 10,
  31 + TotalScore: 30,
  32 + TotalRate: 10,
  33 + })
  34 + list = append(list, configs.RoomRankRobotConfig{
  35 + Id: 2,
  36 + MinScore: 20,
  37 + TotalScore: 50,
  38 + TotalRate: 6,
  39 + })
  40 + list = append(list, configs.RoomRankRobotConfig{
  41 + Id: 3,
  42 + MinScore: 50,
  43 + TotalScore: 200,
  44 + TotalRate: 5,
  45 + })
  46 + fmt.Println(zjson.Str(list))
29 } 47 }
30 48
31 c.RetRspCodeData(code_msg.RECODE_OK, rsp) 49 c.RetRspCodeData(code_msg.RECODE_OK, rsp)
service-common/svconst/mysql.go
@@ -11,11 +11,11 @@ const ( @@ -11,11 +11,11 @@ const (
11 MYSQL_MERGECONFIG = "merge_config" 11 MYSQL_MERGECONFIG = "merge_config"
12 MYSQL_DEFAULT_QUERY_MAXCOUNT = 100 12 MYSQL_DEFAULT_QUERY_MAXCOUNT = 100
13 13
14 - MYSQL_TABLE_S_CARDHOLDER_CONFIG = "s_card_activity_" // 开卡包活动配置  
15 - MYSQL_TABLE_S_CARDHOLDER_DATA = "s_cardholder_data_" // 开卡包活动数据  
16 - MYSQL_TABLE_S_CARDHOLDER_RECORD_OPEN = "s_cardholder_record_open_" // 开卡包活动日志开卡包  
17 - MYSQL_TABLE_S_CARDHOLDER_RECORD_REWARDALBUM = "s_cardholder_record_rewardalbum_" // 开卡包活动日志领取卡组奖励  
18 - MYSQL_TABLE_S_CARDHOLDER_RECORD_REWARDROUND = "s_cardholder_record_rewardround_" // 开卡包活动日志领取轮次奖励 14 + MYSQL_TABLE_S_CARDHOLDER_CONFIG = "s_card_activity" // 开卡包活动配置
  15 + MYSQL_TABLE_S_CARDHOLDER_DATA = "s_cardholder_data" // 开卡包活动数据
  16 + MYSQL_TABLE_S_CARDHOLDER_RECORD_OPEN = "s_cardholder_record_open" // 开卡包活动日志开卡包
  17 + MYSQL_TABLE_S_CARDHOLDER_RECORD_REWARDALBUM = "s_cardholder_record_rewardalbum" // 开卡包活动日志领取卡组奖励
  18 + MYSQL_TABLE_S_CARDHOLDER_RECORD_REWARDROUND = "s_cardholder_record_rewardround" // 开卡包活动日志领取轮次奖励
19 19
20 MYSQL_TABLE_S_ROOMRANK_CONFIG = "s_roomrank_activity_" // 房间排行活动配置 20 MYSQL_TABLE_S_ROOMRANK_CONFIG = "s_roomrank_activity_" // 房间排行活动配置
21 MYSQL_TABLE_S_ROOMRANK_PLAYER = "s_roomrank_player_" // 房间排行玩家数据 21 MYSQL_TABLE_S_ROOMRANK_PLAYER = "s_roomrank_player_" // 房间排行玩家数据
service/cardholder/dto-game.go
@@ -6,6 +6,7 @@ import ( @@ -6,6 +6,7 @@ import (
6 "apigame/util/util-lx/lxalilog" 6 "apigame/util/util-lx/lxalilog"
7 "apigame/util/util-lx/lxtime" 7 "apigame/util/util-lx/lxtime"
8 "encoding/json" 8 "encoding/json"
  9 + "fmt"
9 ) 10 )
10 11
11 // DataCardHolder 卡牌活动持久数据 12 // DataCardHolder 卡牌活动持久数据
@@ -24,7 +25,7 @@ func (d *DataCardHolder) MysqlInfo(suffix string) *svmysql.MysqlInfo { @@ -24,7 +25,7 @@ func (d *DataCardHolder) MysqlInfo(suffix string) *svmysql.MysqlInfo {
24 tableName := svconst.MYSQL_TABLE_S_CARDHOLDER_DATA 25 tableName := svconst.MYSQL_TABLE_S_CARDHOLDER_DATA
25 return &svmysql.MysqlInfo{ 26 return &svmysql.MysqlInfo{
26 DbMysql: svconst.DbCommon, 27 DbMysql: svconst.DbCommon,
27 - TableName: tableName + suffix, 28 + TableName: fmt.Sprintf("%s_%s", tableName, suffix),
28 } 29 }
29 } 30 }
30 31
service/cardholder/dto-record.go
@@ -4,6 +4,7 @@ import ( @@ -4,6 +4,7 @@ import (
4 "apigame/service-common/svconst" 4 "apigame/service-common/svconst"
5 "apigame/service-common/svmysql" 5 "apigame/service-common/svmysql"
6 "apigame/util/util-lx/lxtime" 6 "apigame/util/util-lx/lxtime"
  7 + "fmt"
7 ) 8 )
8 9
9 // RecordCardHolderBase 开卡包活动日志公共 10 // RecordCardHolderBase 开卡包活动日志公共
@@ -43,7 +44,7 @@ func (d *RecordCardHolderOpen) MysqlInfo(suffix string) *svmysql.MysqlInfo { @@ -43,7 +44,7 @@ func (d *RecordCardHolderOpen) MysqlInfo(suffix string) *svmysql.MysqlInfo {
43 tableName := svconst.MYSQL_TABLE_S_CARDHOLDER_RECORD_OPEN 44 tableName := svconst.MYSQL_TABLE_S_CARDHOLDER_RECORD_OPEN
44 return &svmysql.MysqlInfo{ 45 return &svmysql.MysqlInfo{
45 DbMysql: svconst.DbCommon, 46 DbMysql: svconst.DbCommon,
46 - TableName: tableName + suffix, 47 + TableName: fmt.Sprintf("%s_%s", tableName, suffix),
47 } 48 }
48 } 49 }
49 50
@@ -68,7 +69,7 @@ func (d *RecordCardHolderRewardAlbum) MysqlInfo(suffix string) *svmysql.MysqlInf @@ -68,7 +69,7 @@ func (d *RecordCardHolderRewardAlbum) MysqlInfo(suffix string) *svmysql.MysqlInf
68 tableName := svconst.MYSQL_TABLE_S_CARDHOLDER_RECORD_REWARDALBUM 69 tableName := svconst.MYSQL_TABLE_S_CARDHOLDER_RECORD_REWARDALBUM
69 return &svmysql.MysqlInfo{ 70 return &svmysql.MysqlInfo{
70 DbMysql: svconst.DbCommon, 71 DbMysql: svconst.DbCommon,
71 - TableName: tableName + suffix, 72 + TableName: fmt.Sprintf("%s_%s", tableName, suffix),
72 } 73 }
73 } 74 }
74 75
@@ -91,7 +92,7 @@ func (d *RecordCardHolderRewardRound) MysqlInfo(suffix string) *svmysql.MysqlInf @@ -91,7 +92,7 @@ func (d *RecordCardHolderRewardRound) MysqlInfo(suffix string) *svmysql.MysqlInf
91 tableName := svconst.MYSQL_TABLE_S_CARDHOLDER_RECORD_REWARDROUND 92 tableName := svconst.MYSQL_TABLE_S_CARDHOLDER_RECORD_REWARDROUND
92 return &svmysql.MysqlInfo{ 93 return &svmysql.MysqlInfo{
93 DbMysql: svconst.DbCommon, 94 DbMysql: svconst.DbCommon,
94 - TableName: tableName + suffix, 95 + TableName: fmt.Sprintf("%s_%s", tableName, suffix),
95 } 96 }
96 } 97 }
97 98
service/cardholder/logic.go
@@ -7,9 +7,9 @@ import ( @@ -7,9 +7,9 @@ import (
7 "apigame/service/code-msg" 7 "apigame/service/code-msg"
8 "apigame/util/util-lx/lxalilog" 8 "apigame/util/util-lx/lxalilog"
9 "apigame/util/util-lx/lxtime" 9 "apigame/util/util-lx/lxtime"
10 - "apigame/util/utjson"  
11 "apigame/util/utslice" 10 "apigame/util/utslice"
12 "apigame/util/utstring" 11 "apigame/util/utstring"
  12 + "apigame/util/zjson"
13 "github.com/samber/lo" 13 "github.com/samber/lo"
14 "sort" 14 "sort"
15 "strconv" 15 "strconv"
@@ -197,7 +197,7 @@ func DoOpen(gameId string, @@ -197,7 +197,7 @@ func DoOpen(gameId string,
197 { 197 {
198 recordBase := NewRecordCardHolderBase(player.Uid, sequenceId, cohort, config.Id, player.Details.Round) 198 recordBase := NewRecordCardHolderBase(player.Uid, sequenceId, cohort, config.Id, player.Details.Round)
199 _ = svmysql.Create(NewRecordCardHolderOpen(recordBase, 199 _ = svmysql.Create(NewRecordCardHolderOpen(recordBase,
200 - openMode, utstring.StringToInt(confCardholder.Id), utjson.JsonString(newCards)), 200 + openMode, utstring.StringToInt(confCardholder.Id), zjson.Str(newCards)),
201 gameId) 201 gameId)
202 } 202 }
203 203
util/utjson/json.go
@@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
1 -package utjson  
2 -  
3 -import "encoding/json"  
4 -  
5 -func JsonString(o any) string {  
6 - bs, _ := json.Marshal(o)  
7 - return string(bs)  
8 -}