|
@@ -116,11 +116,11 @@ func getIncomeListV2(ch chan models.IncomeChartResp) (incomeChart models.IncomeC
|
|
|
}
|
|
|
ch <- incomeChart
|
|
|
}()
|
|
|
- //todayStr := utils.GetToday("20060102")
|
|
|
- //key := "admin:home:fmsIncomeList:" + todayStr
|
|
|
+ todayStr := utils.GetToday("20060102")
|
|
|
+ key := "admin:home:fmsIncomeList:" + todayStr
|
|
|
|
|
|
- //redisJsonData, redisErr := global.Redis.Get(context.TODO(), key).Result()
|
|
|
- //if redisErr != nil {
|
|
|
+ redisJsonData, redisErr := global.Redis.Get(context.TODO(), key).Result()
|
|
|
+ if redisErr != nil {
|
|
|
var dateSlice []string
|
|
|
var contractMoneySlice []float64
|
|
|
var ArrivalMoneySlice []float64
|
|
@@ -188,16 +188,16 @@ func getIncomeListV2(ch chan models.IncomeChartResp) (incomeChart models.IncomeC
|
|
|
incomeChart.ContractMoney = contractMoneySlice
|
|
|
incomeChart.ArrivalMoney = ArrivalMoneySlice
|
|
|
|
|
|
- //redisJsonData, err := json.Marshal(incomeChart)
|
|
|
- //if err == nil {
|
|
|
- // global.Redis.SetEX(context.TODO(), key, string(redisJsonData), time.Minute*30)
|
|
|
- //}
|
|
|
- //}else {
|
|
|
- //err = json.Unmarshal([]byte(redisJsonData), &incomeChart)
|
|
|
- //if err != nil {
|
|
|
- // fmt.Println("近两年的收入统计数据,json转换失败")
|
|
|
- //}
|
|
|
- //}
|
|
|
+ redisJsonData, err := json.Marshal(incomeChart)
|
|
|
+ if err == nil {
|
|
|
+ global.Redis.SetEX(context.TODO(), key, string(redisJsonData), time.Minute*30)
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ err = json.Unmarshal([]byte(redisJsonData), &incomeChart)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("近两年的收入统计数据,json转换失败")
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
return
|
|
|
}
|