|
|
|
@@ -12,21 +12,21 @@ import (
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
const (
|
|
|
|
rds_NCOV_STATISTIC_KEY = "nCovStatistic"
|
|
|
|
rds_NCOV_STATISTIC_KEY = "nCovStatistic"
|
|
|
|
rds_CHINA_TOTAL_KEY = "chinaTotal"
|
|
|
|
rds_CHINA_TOTAL_KEY = "chinaTotal"
|
|
|
|
rds_CHINA_ADD_KEY = "chinaAdd"
|
|
|
|
rds_CHINA_ADD_KEY = "chinaAdd"
|
|
|
|
rds_COUNTRY_LEVEL_KEY = "countryLevel"
|
|
|
|
rds_COUNTRY_LEVEL_KEY = "countryLevel"
|
|
|
|
rds_COUNTRY_LEVEL_CHILD_KEY = "countryLevelChild"
|
|
|
|
rds_COUNTRY_LEVEL_CHILD_KEY = "countryLevelChild"
|
|
|
|
rds_PROVIENCE_LEVEL_CHILD_KEY = "provienceLevelChild"
|
|
|
|
rds_PROVINCE_LEVEL_CHILD_KEY = "provinceLevelChild"
|
|
|
|
rds_PROVIENCE_LEVEL_NOW_CONFIRM_KEY = "provienceLevelNowConfirm"
|
|
|
|
rds_PROVINCE_LEVEL_NOW_CONFIRM_KEY = "provinceLevelNowConfirm"
|
|
|
|
rds_PROVIENCE_LEVEL_TODAY_CONFIRM_KEY = "provienceLevelTodayConfirm"
|
|
|
|
rds_PROVINCE_LEVEL_TODAY_CONFIRM_KEY = "provinceLevelTodayConfirm"
|
|
|
|
rds_PROVIENCE_LEVEL_TOTAL_CONFIRM_KEY = "provienceLevelTotalConfirm"
|
|
|
|
rds_PROVINCE_LEVEL_TOTAL_CONFIRM_KEY = "provinceLevelTotalConfirm"
|
|
|
|
rds_CITY_LEVEL_CHILD_KEY = "cityLevelChild"
|
|
|
|
rds_CITY_LEVEL_CHILD_KEY = "cityLevelChild"
|
|
|
|
rds_CITY_LEVEL_NOW_CONFIRM_KEY = "cityLevelNowConfirm"
|
|
|
|
rds_CITY_LEVEL_NOW_CONFIRM_KEY = "cityLevelNowConfirm"
|
|
|
|
rds_CITY_LEVEL_TODAY_CONFIRM_KEY = "cityLevelTodayConfirm"
|
|
|
|
rds_CITY_LEVEL_TODAY_CONFIRM_KEY = "cityLevelTodayConfirm"
|
|
|
|
rds_CITY_LEVEL_TOTAL_CONFIRM_KEY = "cityLevelTotalConfirm"
|
|
|
|
rds_CITY_LEVEL_TOTAL_CONFIRM_KEY = "cityLevelTotalConfirm"
|
|
|
|
rds_LAST_UPDATE_TIME = "statisticsLastUpdateTime"
|
|
|
|
rds_LAST_UPDATE_TIME = "statisticsLastUpdateTime"
|
|
|
|
rds_LAST_CACHE_TIME = "statisticsLastCacheTime"
|
|
|
|
rds_LAST_CACHE_TIME = "statisticsLastCacheTime"
|
|
|
|
|
|
|
|
|
|
|
|
SORT_TODAY_CONFIRM = "today"
|
|
|
|
SORT_TODAY_CONFIRM = "today"
|
|
|
|
SORT_TOTAL_CONFIRM = "total"
|
|
|
|
SORT_TOTAL_CONFIRM = "total"
|
|
|
|
@@ -80,8 +80,8 @@ func cacheLevelInfo(data map[string]interface{}) {
|
|
|
|
// Get Every Level's Info
|
|
|
|
// Get Every Level's Info
|
|
|
|
var countryLevels []models.AreaInfo
|
|
|
|
var countryLevels []models.AreaInfo
|
|
|
|
json.Unmarshal(areaTree, &countryLevels)
|
|
|
|
json.Unmarshal(areaTree, &countryLevels)
|
|
|
|
provienceLevels := children(countryLevels)
|
|
|
|
provinceLevels := children(countryLevels)
|
|
|
|
cityLevels := children(provienceLevels)
|
|
|
|
cityLevels := children(provinceLevels)
|
|
|
|
|
|
|
|
|
|
|
|
// Country Level Area Info With Child
|
|
|
|
// Country Level Area Info With Child
|
|
|
|
cacheList(rds_COUNTRY_LEVEL_CHILD_KEY, areaInfoToJson(countryLevels)...)
|
|
|
|
cacheList(rds_COUNTRY_LEVEL_CHILD_KEY, areaInfoToJson(countryLevels)...)
|
|
|
|
@@ -89,34 +89,34 @@ func cacheLevelInfo(data map[string]interface{}) {
|
|
|
|
areaInfoChildNil(&countryLevels)
|
|
|
|
areaInfoChildNil(&countryLevels)
|
|
|
|
cacheList(rds_COUNTRY_LEVEL_KEY, areaInfoToJson(countryLevels)...)
|
|
|
|
cacheList(rds_COUNTRY_LEVEL_KEY, areaInfoToJson(countryLevels)...)
|
|
|
|
|
|
|
|
|
|
|
|
// Provience Level Area Info With Child
|
|
|
|
// Province Level Area Info With Child
|
|
|
|
cacheList(rds_PROVIENCE_LEVEL_CHILD_KEY, areaInfoToJson(provienceLevels)...)
|
|
|
|
cacheList(rds_PROVINCE_LEVEL_CHILD_KEY, areaInfoToJson(provinceLevels)...)
|
|
|
|
areaInfoChildNil(&provienceLevels)
|
|
|
|
areaInfoChildNil(&provinceLevels)
|
|
|
|
// City Level Area Info With Child
|
|
|
|
// City Level Area Info With Child
|
|
|
|
cacheList(rds_CITY_LEVEL_CHILD_KEY, areaInfoToJson(cityLevels)...)
|
|
|
|
cacheList(rds_CITY_LEVEL_CHILD_KEY, areaInfoToJson(cityLevels)...)
|
|
|
|
areaInfoChildNil(&provienceLevels)
|
|
|
|
areaInfoChildNil(&provinceLevels)
|
|
|
|
|
|
|
|
|
|
|
|
// Provience Level Area Info Sorted by Now Confirm
|
|
|
|
// Province Level Area Info Sorted by Now Confirm
|
|
|
|
provienceLevelsSlice := AreaSlice(provienceLevels)
|
|
|
|
provinceLevelsSlice := AreaSlice(provinceLevels)
|
|
|
|
sort.Sort(provienceLevelsSlice)
|
|
|
|
sort.Sort(provinceLevelsSlice)
|
|
|
|
cacheList(rds_PROVIENCE_LEVEL_NOW_CONFIRM_KEY, areaInfoToJson(provienceLevelsSlice)...)
|
|
|
|
cacheList(rds_PROVINCE_LEVEL_NOW_CONFIRM_KEY, areaInfoToJson(provinceLevelsSlice)...)
|
|
|
|
// City Level Area Info Sorted By Now Confirm
|
|
|
|
// City Level Area Info Sorted By Now Confirm
|
|
|
|
cityLevelsSlice := AreaSlice(cityLevels)
|
|
|
|
cityLevelsSlice := AreaSlice(cityLevels)
|
|
|
|
sort.Sort(cityLevelsSlice)
|
|
|
|
sort.Sort(cityLevelsSlice)
|
|
|
|
cacheList(rds_CITY_LEVEL_NOW_CONFIRM_KEY, areaInfoToJson(cityLevelsSlice)...)
|
|
|
|
cacheList(rds_CITY_LEVEL_NOW_CONFIRM_KEY, areaInfoToJson(cityLevelsSlice)...)
|
|
|
|
|
|
|
|
|
|
|
|
sortBy = SORT_TODAY_CONFIRM
|
|
|
|
sortBy = SORT_TODAY_CONFIRM
|
|
|
|
// Provience Level Area Info Sorted by Today Confirm
|
|
|
|
// Province Level Area Info Sorted by Today Confirm
|
|
|
|
sort.Sort(provienceLevelsSlice)
|
|
|
|
sort.Sort(provinceLevelsSlice)
|
|
|
|
cacheList(rds_PROVIENCE_LEVEL_TODAY_CONFIRM_KEY, areaInfoToJson(provienceLevelsSlice)...)
|
|
|
|
cacheList(rds_PROVINCE_LEVEL_TODAY_CONFIRM_KEY, areaInfoToJson(provinceLevelsSlice)...)
|
|
|
|
// City Level Area Info Sorted by Today Confirm
|
|
|
|
// City Level Area Info Sorted by Today Confirm
|
|
|
|
sort.Sort(cityLevelsSlice)
|
|
|
|
sort.Sort(cityLevelsSlice)
|
|
|
|
cacheList(rds_CITY_LEVEL_TODAY_CONFIRM_KEY, areaInfoToJson(cityLevelsSlice)...)
|
|
|
|
cacheList(rds_CITY_LEVEL_TODAY_CONFIRM_KEY, areaInfoToJson(cityLevelsSlice)...)
|
|
|
|
|
|
|
|
|
|
|
|
sortBy = SORT_TOTAL_CONFIRM
|
|
|
|
sortBy = SORT_TOTAL_CONFIRM
|
|
|
|
// Provience Level Area Info Sorted by Total Confirm
|
|
|
|
// Province Level Area Info Sorted by Total Confirm
|
|
|
|
sort.Sort(provienceLevelsSlice)
|
|
|
|
sort.Sort(provinceLevelsSlice)
|
|
|
|
cacheList(rds_PROVIENCE_LEVEL_TOTAL_CONFIRM_KEY, areaInfoToJson(provienceLevelsSlice)...)
|
|
|
|
cacheList(rds_PROVINCE_LEVEL_TOTAL_CONFIRM_KEY, areaInfoToJson(provinceLevelsSlice)...)
|
|
|
|
// City Level Area Info Sorted by Total Confirm
|
|
|
|
// City Level Area Info Sorted by Total Confirm
|
|
|
|
sort.Sort(cityLevelsSlice)
|
|
|
|
sort.Sort(cityLevelsSlice)
|
|
|
|
cacheList(rds_CITY_LEVEL_TOTAL_CONFIRM_KEY, areaInfoToJson(cityLevelsSlice)...)
|
|
|
|
cacheList(rds_CITY_LEVEL_TOTAL_CONFIRM_KEY, areaInfoToJson(cityLevelsSlice)...)
|
|
|
|
@@ -136,6 +136,7 @@ func children(parents []models.AreaInfo) []models.AreaInfo {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for _, item := range parent.Children {
|
|
|
|
for _, item := range parent.Children {
|
|
|
|
name := item.Name
|
|
|
|
name := item.Name
|
|
|
|
|
|
|
|
item.Parent = parent.Name
|
|
|
|
if !strings.Contains(name, json_FOREIGN_CITY) && !strings.Contains(name, json_FOREIGN_COUNTRY) && !strings.Contains(name, json_TO_BE_CONFIRM) {
|
|
|
|
if !strings.Contains(name, json_FOREIGN_CITY) && !strings.Contains(name, json_FOREIGN_COUNTRY) && !strings.Contains(name, json_TO_BE_CONFIRM) {
|
|
|
|
areaInfos = append(areaInfos, item)
|
|
|
|
areaInfos = append(areaInfos, item)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|