get.go
1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package confcardholder
import (
"apigame/configs/confbase"
)
// GetCurrent 获取 当前配置
func GetCurrent(gameId string) (conf *ActivityConfig, has bool) {
//currentKey := fmt.Sprintf("%s:%s:%s:current",
// svconst.REDIS_CACHEP_REFIX,
// svconst.MYSQL_TABLE_S_CARDHOLDER_CONFIG,
// gameId)
//currentId := zredis.GetInt64(zredis.GetConn(), currentKey)
//timeNow := lxtime.NowUninx()
//confRaw := new(ActivityConfigRaw)
//hasFind := false
//if currentId == 0 {
// hasFind = confbase.FindDuringTime(confRaw, gameId)
//} else {
// conf, has = GetConfig(gameId, currentId)
// if has {
// if timeNow < conf.StartTime || timeNow > conf.EndTime {
// hasFind = confbase.FindDuringTime(confRaw, gameId)
// }
// } else {
// hasFind = confbase.FindDuringTime(confRaw, gameId)
// }
//}
//if hasFind {
// conf = new(ActivityConfig)
// conf.Decode(gameId, confRaw)
// svredis.SaveData(gameId, conf)
// has = true
// currentId = conf.Id
// _ = zredis.Set(zredis.GetConn(), currentKey, utstring.Int64ToString(currentId))
//}
conf = new(ActivityConfig)
has = confbase.GetCurrent[*ActivityConfig, ActivityConfigRaw](gameId, conf)
return
}
// GetConfig 获取 配置根据Id
func GetConfig(gameId string, confId int64) (conf *ActivityConfig, has bool) {
conf = new(ActivityConfig)
has = confbase.GetConfig[*ActivityConfig, ActivityConfigRaw](gameId, confId, conf)
return
}