|
@@ -9,6 +9,7 @@ import (
|
|
|
"eta/eta_chart_lib/services/data/table"
|
|
|
"eta/eta_chart_lib/services/excel"
|
|
|
"eta/eta_chart_lib/utils"
|
|
|
+ "fmt"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -38,22 +39,22 @@ func (this *ExcelInfoController) GetTableDetail() {
|
|
|
}
|
|
|
key := utils.HZ_CHART_LIB_EXCEL_TABLE_DETAIL + ":" + uniqueCode
|
|
|
resp := new(response.ExcelTableDetailResp)
|
|
|
- ////判断是否有缓存
|
|
|
- //if utils.Re == nil {
|
|
|
- // if utils.Re == nil && utils.Rc.IsExist(key) {
|
|
|
- // if data, err1 := utils.Rc.RedisBytes(key); err1 == nil {
|
|
|
- // err := json.Unmarshal(data, &resp)
|
|
|
- // if err == nil && resp != nil {
|
|
|
- // br.Ret = 200
|
|
|
- // br.Success = true
|
|
|
- // br.Msg = "获取成功"
|
|
|
- // br.Data = resp
|
|
|
- // fmt.Println("source redis")
|
|
|
- // return
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- //}
|
|
|
+ //判断是否有缓存
|
|
|
+ if utils.Re == nil {
|
|
|
+ if utils.Re == nil && utils.Rc.IsExist(key) {
|
|
|
+ if data, err1 := utils.Rc.RedisBytes(key); err1 == nil {
|
|
|
+ err := json.Unmarshal(data, &resp)
|
|
|
+ if err == nil && resp != nil {
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+ fmt.Println("source redis")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
excelInfo, err := models.GetExcelInfoByUniqueCode(uniqueCode)
|
|
|
if err != nil {
|
|
@@ -137,7 +138,7 @@ func (this *ExcelInfoController) GetTableDetail() {
|
|
|
|
|
|
if utils.Re == nil {
|
|
|
data, _ := json.Marshal(resp)
|
|
|
- utils.Rc.Put(key, data, 10*time.Minute)
|
|
|
+ utils.Rc.Put(key, data, 5*time.Minute)
|
|
|
}
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|