init.go
2.32 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package configs
import (
"apigame/configs/confapi"
"apigame/configs/confcardholder"
"apigame/configs/confglobal"
"apigame/configs/confroomrank"
"apigame/service-common/svconst"
"apigame/util/zconvert"
"apigame/util/zmap"
"fmt"
"github.com/astaxie/beego"
"sort"
"strings"
)
func Init() bool {
for _, gameId := range svconst.GameList {
_, _ = confapi.GetConfig(gameId)
}
for _, gameId := range svconst.GameList {
_, _ = confglobal.GetConfig(gameId)
}
for _, gameId := range svconst.GameListCardHolder {
_, _ = confcardholder.GetCurrent(gameId)
}
//for _, gameId := range svconst.GameListRoomRank {
// _, _ = confroomrank.GetCurrent(gameId)
//}
//{
// config, hasConfig := confroomrank.GetCurrent("10149", 30002)
// if hasConfig {
// items := zmap.Values(config.Robot)
// sort.Slice(items, func(i, j int) bool {
// return items[i].Id < items[j].Id
// })
// fmt.Println("----------------")
// for _, i2 := range items {
// fmt.Println(i2.Id)
// }
// fmt.Println("----------------")
// for _, i2 := range items {
// fmt.Println(i2.MinScore)
// }
// fmt.Println("----------------")
// for _, i2 := range items {
// fmt.Println(i2.TotalScore)
// }
// fmt.Println("----------------")
// for _, i2 := range items {
// fmt.Println(i2.Range)
// }
// fmt.Println("----------------")
// }
//}
if beego.BConfig.RunMode == "dev" {
dump()
}
return true
}
func dump() {
config, hasConfig := confroomrank.GetCurrent("10149", 30002)
if hasConfig {
items := zmap.Values(config.Room)
sort.Slice(items, func(i, j int) bool {
return items[i].Id < items[j].Id
})
for _, i2 := range items {
//fmt.Println(i2.Levels)
//fmt.Println(strings.Join(zconvert.ListIntegerToListString(i2.SettleUserType), ","))
//{
// ltxt := make([]string, 0)
// for _, i3 := range i2.PlayerTypeCount {
// txt := strings.Join(zconvert.ListIntegerToListString(i3), ",")
// ltxt = append(ltxt, txt)
// }
// fmt.Println(strings.Join(ltxt, "|"))
//}
{
ltxt := make([]string, 0)
ks := zmap.Keys(i2.Awards)
sort.Slice(ks, func(i, j int) bool {
return zconvert.ToInt(ks[i]) < zconvert.ToInt(ks[j])
})
for _, k := range ks {
txt := fmt.Sprintf("%s:%s", k, i2.Awards[k])
ltxt = append(ltxt, txt)
}
fmt.Println(strings.Join(ltxt, "_"))
}
}
}
}