Browse Source

change gorm

Roc 1 tháng trước cách đây
mục cha
commit
f43134f957
1 tập tin đã thay đổi với 21 bổ sung21 xóa
  1. 21 21
      controllers/chart_common.go

+ 21 - 21
controllers/chart_common.go

@@ -71,27 +71,27 @@ func (this *ChartController) CommonChartInfoDetailFromUniqueCode() {
 		isCollect = tmpIsCollect
 	}
 	//判断是否有缓存
-	//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 {
-	//				if conf[models.BusinessConfWatermarkChart] == "true" && conf[models.BusinessConfCompanyWatermark] != "" {
-	//					resp.WaterMark = conf[models.BusinessConfCompanyWatermark]
-	//				}
-	//				if isCollect {
-	//					resp.IsCollect = isCollect
-	//				}
-	//				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 {
+					if conf[models.BusinessConfWatermarkChart] == "true" && conf[models.BusinessConfCompanyWatermark] != "" {
+						resp.WaterMark = conf[models.BusinessConfCompanyWatermark]
+					}
+					if isCollect {
+						resp.IsCollect = isCollect
+					}
+					br.Ret = 200
+					br.Success = true
+					br.Msg = "获取成功"
+					br.Data = resp
+					fmt.Println("source redis")
+					return
+				}
+			}
+		}
+	}
 
 	chartInfo, err := models.GetChartInfoByUniqueCode(uniqueCode)
 	if err != nil {