fix: add role limit

This commit is contained in:
fallen-angle
2022-04-27 22:08:02 +08:00
parent fc347a4140
commit 22cb5ec61f
19 changed files with 274 additions and 77 deletions

View File

@@ -48,7 +48,10 @@ func cacheNCovStatistics() {
var nCovRes map[string]string
json.Unmarshal([]byte(resp), &nCovRes)
var nCovResData map[string]interface{}
json.Unmarshal([]byte(nCovRes["data"]), &nCovResData)
err := json.Unmarshal([]byte(nCovRes["data"]), &nCovResData)
if err != nil {
panic(err)
}
if !needToRecache(nCovResData) {
return
}

View File

@@ -36,6 +36,7 @@ func GetAllCityData(sort string) []interface{} {
}
func GetCountryData(child bool) []interface{} {
checkCache()
if child {
return getEntireRedisList(rds_COUNTRY_LEVEL_CHILD_KEY)
}
@@ -43,6 +44,7 @@ func GetCountryData(child bool) []interface{} {
}
func GetChinaNCovStatistic() models.ChinaData {
checkCache()
data := models.ChinaData{}
json.Unmarshal([]byte(global.Redis.Get(rds_CHINA_ADD_KEY).Val()), &data.ChinaAdd)
json.Unmarshal([]byte(global.Redis.Get(rds_CHINA_TOTAL_KEY).Val()), &data.ChinaTotal)