config-load.go
1.55 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package cardholder
import (
"apigame/common/svconst"
)
// Init1 初始化
func Init1() {
NewConfigs()
TryUpdateConfigs()
}
// TryUpdateConfigs 尝试更新配置表
func TryUpdateConfigs() {
LoadConfigs()
}
// LoadConfigs 读取mysql配置
func LoadConfigs() {
for _, gameId := range svconst.GameListCardHolder {
LoadConfig(gameId)
}
}
// TryUpdateConfig 尝试更新配置表
func TryUpdateConfig(gameId string) (config *CardActivityConfig, has bool) {
LoadConfig(gameId)
return GetConfig(gameId)
}
// LoadConfig 读取mysql配置
func LoadConfig(gameId string) {
//// 找到当前开放的活动
//configOpen := CardActivityUpdateConfig{Id: 0}
//{
// conf := make([]CardActivityUpdateConfig, 0)
// _, err := svdto.Find(&conf, new(CardActivityUpdateConfig), gameId)
// if err != nil {
// return
// }
// for _, config := range conf {
// if config.Status != 0 {
// configOpen = config
// continue
// }
// }
// fmt.Println(configOpen)
//}
//// 没有开放的活动
//if configOpen.Id == 0 {
// return
//}
//// 判断是否需要更新
//needUpdate := false
//configOld, hasConfigOld := GetConfig(gameId)
//if hasConfigOld {
// if configOpen.Id != configOld.Raw.Id || configOpen.UpdateTime != configOld.Raw.UpdateTime {
// needUpdate = true
// }
//} else {
// needUpdate = true
//}
//// 更新数据
//if needUpdate {
// confNew := &CardActivityConfigRaw{}
// hasConfNew, err := svdto.First(confNew, gameId)
// if err != nil {
// return
// }
// if !hasConfNew {
// return
// }
// ConfigDecode(gameId, confNew)
//}
}