Browse Source

feat:缓存日志

wangshan 2 years ago
parent
commit
f3889c2567

+ 8 - 8
src/jfw/modules/app/src/app/front/tags.go

@@ -110,7 +110,7 @@ onceAgain:
 	if res := redis.Get("seoCache", tagsMobileKey); res == nil || res == "" {
 		var (
 			infoTypeList                        []map[string]interface{} //信息类型
-			currentLocation                     []*jyutil.SeoInfo
+			currentLocation                     []jyutil.SeoInfo
 			hasIndustryNav                      bool // 有没有招标导航
 			prevPage, nextPage, tdk, areaTopTip string
 			topInfoMap                          = map[string]*jyutil.SeoInfo{}
@@ -133,13 +133,13 @@ onceAgain:
 			if len(codes) == 2 || len(codes) == 1 {
 				if jyutil.AreaCityToCode[codes[0]] != nil {
 					biddingInfo.IsEffective = true
-					currentLocation = append(currentLocation, jyutil.AreaCityToCode[codes[0]])
+					currentLocation = append(currentLocation, *jyutil.AreaCityToCode[codes[0]])
 					biddingInfo.Area = jyutil.AreaCityToCode[codes[0]].Name
 					tdk = biddingInfo.Area
 					areaTopTip = fmt.Sprintf("%s%s", biddingInfo.Area, "招标网")
 					if len(codes) == 2 {
 						if jyutil.AreaCityToCode[name] != nil {
-							currentLocation = append(currentLocation, jyutil.AreaCityToCode[name])
+							currentLocation = append(currentLocation, *jyutil.AreaCityToCode[name])
 							biddingInfo.City = jyutil.AreaCityToCode[name].Name
 							areaTopTip = fmt.Sprintf("%s%s", biddingInfo.City, "招标网")
 							tdk = biddingInfo.City
@@ -174,7 +174,7 @@ onceAgain:
 					}
 					code, _ := strconv.ParseInt(codes[0], 10, 64)
 					tdk = jyutil.CodeToInfoType[code]
-					currentLocation = append(currentLocation, topInfoMap[codes[0]])
+					currentLocation = append(currentLocation, *topInfoMap[codes[0]])
 					biddingInfo.PageFormat(codes[1])
 					prevPage = fmt.Sprintf("%s_%d", codes[0], biddingInfo.PageNum-1)
 					nextPage = fmt.Sprintf("%s_%d", codes[0], biddingInfo.PageNum+1)
@@ -194,7 +194,7 @@ onceAgain:
 				if class1 != "" && class2 != "" && indu2 != "" {
 					biddingInfo.IsEffective = true
 					// 位置导航
-					currentLocation = append(currentLocation, &jyutil.SeoInfo{
+					currentLocation = append(currentLocation, jyutil.SeoInfo{
 						Name: fmt.Sprintf("%s招标采购", indu2),
 					})
 					biddingInfo.Industry = fmt.Sprintf("%s_%s", class1, class2)                 //行业
@@ -220,7 +220,7 @@ onceAgain:
 			prevPage = fmt.Sprintf("%d", biddingInfo.PageNum-1)
 			nextPage = fmt.Sprintf("%d", biddingInfo.PageNum+1)
 			biddingInfo.IsBuyer = true
-			currentLocation = append(currentLocation, &jyutil.SeoInfo{
+			currentLocation = append(currentLocation, jyutil.SeoInfo{
 				Name: "采购单位",
 			})
 			biddingInfo.IsSearch = false
@@ -232,7 +232,7 @@ onceAgain:
 			prevPage = fmt.Sprintf("%d", biddingInfo.PageNum-1)
 			nextPage = fmt.Sprintf("%d", biddingInfo.PageNum+1)
 			biddingInfo.IsWinner = true
-			currentLocation = append(currentLocation, &jyutil.SeoInfo{
+			currentLocation = append(currentLocation, jyutil.SeoInfo{
 				Name: "中标企业",
 			})
 			biddingInfo.IsSearch = false
@@ -267,7 +267,7 @@ onceAgain:
 			tg.T["adList"] = jyutil.GetAdInfo(tg.Request.Host)
 		}
 		if biddingInfo.IsSearch {
-			tg.T["biddingList"] = biddingInfo.GetBiddingInfo(types, name, currentLocation)
+			tg.T["biddingList"] = biddingInfo.GetBiddingInfo(types, codes, currentLocation, isInfoList)
 		}
 		if biddingInfo.PageNum == 1 {
 			prevPage = ""

+ 8 - 4
src/jfw/modules/app/src/app/jyutil/tags.go

@@ -390,11 +390,15 @@ type InfoList struct {
 	Address     string //地址
 }
 
-func (b *BiddingInfo) GetBiddingInfo(types, name string, currentLocation []*SeoInfo) (birt []*InfoRes) {
+func (b *BiddingInfo) GetBiddingInfo(types string, codes []string, currentLocation []SeoInfo, isPaging bool) (birt []*InfoRes) {
 	infoListLock.Lock()
 	defer infoListLock.Unlock()
-	if n := strings.Split(name, "_"); len(n) > 1 {
-		name = strings.Join(n[:len(n)-1], "_")
+	name := strings.Join(codes, "")
+	if n := len(codes); n > 1 {
+		name = strings.Join(codes, "_")
+		if isPaging {
+			name = strings.Join(codes[:n-1], "_")
+		}
 	}
 	redisCount := 0
 	redisKey := fmt.Sprintf(biddingListKey, types, name, b.PageNum)
@@ -483,7 +487,7 @@ func (b *BiddingInfo) GetBiddingInfo(types, name string, currentLocation []*SeoI
 						}
 						bir = []*InfoRes{
 							{
-								Name: fmt.Sprintf("%s%s", currentLocation[0].Name, qu.If(types == "industry" && name != "home", "信息列表", "").(string)),
+								Name: fmt.Sprintf("%s%s", currentLocation[0].Name, qu.If(types == "industry" && name != "all", "信息列表", "").(string)),
 								Url:  "", //currentLocation[0].url
 								List: formatData[start:end],
 							},