Ver Fonte

Merge branch 'feature/v1.0.0_wky' of BaseService/commercialService into feature/v1.0.0

wangkaiyue há 1 ano atrás
pai
commit
3199720b97
1 ficheiros alterados com 7 adições e 10 exclusões
  1. 7 10
      service/action/customer.go

+ 7 - 10
service/action/customer.go

@@ -26,22 +26,19 @@ func (a *Action) Info() {
 	rMap := map[string]interface{}{}
 	switch module {
 	case "tripartiteAuth":
-		AdCode := fmt.Sprintf("ad_%s", module)
-		obj := redis.Get("other", AdCode)
+		cacheKey := fmt.Sprintf("ad_%s", module)
+		obj := redis.Get("other", cacheKey)
 		var adInfo []AdInfo
 		if obj != nil {
 			adInfo = Handle(obj.([]interface{}), a.Request.Host)
 		} else {
-			res, ok := public.MQFW.FindOneByField("ad", `{"s_code":"`+AdCode+`"}`, `{"a_son":1,"l_modifydate":1}`)
+			res, ok := public.MQFW.FindOneByField("ad", `{"s_code":"`+module+`"}`, `{"a_son":1,"l_modifydate":1}`)
 			if ok && res != nil && (*res)["a_son"] != nil {
-				res, ok := public.MQFW.FindOneByField("ad", `{"s_code":"`+AdCode+`"}`, `{"a_son":1}`)
-				if ok && res != nil && (*res)["a_son"] != nil {
-					son := (*res)["a_son"].([]interface{})
-					if len(son) > 0 {
-						redis.Put("other", AdCode, son, int(GetLastTime()))
-					}
-					adInfo = Handle(son, a.Request.Host)
+				son := (*res)["a_son"].([]interface{})
+				if len(son) > 0 {
+					redis.Put("other", cacheKey, son, int(GetLastTime()))
 				}
+				adInfo = Handle(son, a.Request.Host)
 			}
 		}
 		if len(adInfo) > 0 {