registry.go
882 Bytes
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
package configs
import (
"apigame/configs/confroomrank"
"apigame/service-common/svmysql"
"apigame/service-common/svredis"
"apigame/util/util-lx/lxalilog"
"fmt"
)
// GetRoomRankConfig 获取 房间排行活动配置
func GetRoomRankConfig(gameId string) (conf *confroomrank.ActivityConfig, has bool) {
var err error
conf = new(confroomrank.ActivityConfig)
has = svredis.LoadData(gameId, conf)
if has {
fmt.Println("dwjw GetRoomRankConfig use cache")
return
}
confRaw := new(confroomrank.ActivityConfigRaw)
has, err = svmysql.First(confRaw, gameId)
if err != nil {
lxalilog.Errors(err, "configs.GetRoomRankConfig error", gameId)
return
}
if !has {
return
}
conf.Decode(gameId, confRaw)
fmt.Println("dwjw GetRoomRankConfig save cache")
fmt.Println("dwjw🐸", conf.Robot)
fmt.Println("dwjw🐸", conf.Room)
svredis.SaveData(gameId, conf)
return
}