Bläddra i källkod

首页缓存时间修改

renjiaojiao 1 år sedan
förälder
incheckning
5efbeca79c

+ 1 - 1
src/jfw/front/classificationTag.go

@@ -65,7 +65,7 @@ func GetHotIndustry() (rData []map[string][]map[string]interface{}) {
 	}
 	rData = getkeysMap() //热门行业
 	if bytes, err := json.Marshal(rData); err == nil && bytes != nil {
-		_ = redis.PutBytes(RedisNameNew, "pcIndexHotIndustry", &bytes, 2*60*60)
+		_ = redis.PutBytes(RedisNameNew, "pcIndexHotIndustry", &bytes, RedisTimeout)
 	}
 	return rData
 }

+ 2 - 2
src/jfw/front/dataServiceArea.go

@@ -132,7 +132,7 @@ func GovernmentTender(number int) []argument {
 		}
 
 	}
-	redis.Put(RedisNameNew, redisKey, data, 3600*6)
+	redis.Put(RedisNameNew, redisKey, data, RedisTimeout)
 	return data
 }
 
@@ -336,7 +336,7 @@ func PurchasingData() []map[string]interface{} {
 				"url":     fmt.Sprintf("/datasmt/index_1?searchValue=%s", common.InterfaceToStr(m["keyword"])),
 			})
 		}
-		redis.Put(RedisNameNew, "hotPurchasingData", keyWords, 24*3600*30)
+		redis.Put(RedisNameNew, "hotPurchasingData", keyWords, RedisTimeout)
 	}
 
 	return keyWords

+ 6 - 5
src/jfw/front/index.go

@@ -30,6 +30,7 @@ type NewIndex struct {
 }
 
 var (
+	RedisTimeout   = 2 * 3600
 	routerRelayMap map[string]map[bool]string
 	BiddingTypeUrl = map[int]string{
 		1:  "/list/stype/ZBYG.html",
@@ -317,7 +318,7 @@ func GetRecommendBidZone(typ int, pageSize int) (list []map[string]interface{},
 	}
 	finalArr := FillingBiddingBaseFields(gctx.New(), queryRes.List(), typs)
 	if finalArr != nil && len(finalArr) > 0 {
-		redis.Put(RedisNameNew, rediskey, finalArr, 24*3600)
+		redis.Put(RedisNameNew, rediskey, finalArr, RedisTimeout)
 	}
 	return finalArr, typs
 }
@@ -424,7 +425,7 @@ func GetIndexProjectListRedis(typ, pageSize int) (data []map[string]interface{},
 	}
 	data, _ = GetIndexProjectList(typ, pageSize, []map[string]interface{}{})
 	if data != nil && len(data) > 0 {
-		redis.Put(RedisNameNew, redidKey, data, 24*3600+rand.Intn(100))
+		redis.Put(RedisNameNew, redidKey, data, RedisTimeout+rand.Intn(100))
 	}
 	return data, types
 }
@@ -454,7 +455,7 @@ func GetIndexRecommendProjectList(typ, pageSize int) (data []map[string]interfac
 		data = append(data, v)
 	}
 	if data != nil && len(data) > 0 {
-		redis.Put(RedisNameNew, redidKey, data, 24*3600+rand.Intn(100))
+		redis.Put(RedisNameNew, redidKey, data, RedisTimeout+rand.Intn(100))
 	}
 	return data, types
 }
@@ -499,7 +500,7 @@ func GetBidInfoPublishEnt() (res [][]map[string]interface{}) {
 					res = append(res, once)
 				}
 			}
-			redis.Put(RedisNameNew, "pcIndexBidInfoGoodPublishEnt", res, 24*3600)
+			redis.Put(RedisNameNew, "pcIndexBidInfoGoodPublishEnt", res, RedisTimeout+rand.Intn(100))
 		}
 	}
 	return res
@@ -517,7 +518,7 @@ func GetImportBidding() []*hotKeyWord {
 	randomNumber := rand.Intn(len(subjectMatter) - 30)
 	res := subjectMatter[randomNumber : randomNumber+30]
 	if len(res) > 0 {
-		redis.Put(RedisNameNew, "pcIndexImportBidding", res, 24*3600)
+		redis.Put(RedisNameNew, "pcIndexImportBidding", res, RedisTimeout+rand.Intn(100))
 	}
 	return res
 }

+ 5 - 2
src/jfw/front/nzjProject.go

@@ -699,7 +699,7 @@ func NewHotEnt(isWinner bool, number int) (data []map[string]interface{}) {
 		} else {
 			data = redisData
 		}
-		redis.Put("newother", redisKey, data, 3600*24)
+		redis.Put("newother", redisKey, data, RedisTimeout)
 	}
 	return
 }
@@ -815,7 +815,7 @@ func GetEsWinner(number int) (data []map[string]interface{}) {
 				k: v,
 			})
 		}
-		redis.Put(RedisNameNew, "bid_winning_news", data, 3600*24)
+		redis.Put(RedisNameNew, "bid_winning_news", data, RedisTimeout+rand.Intn(100))
 	}
 	return
 }
@@ -837,6 +837,9 @@ func IndexNzjProject(number int) (data []map[string]interface{}) {
 				"proposed_id":  encrypt.SE2.Encode2Hex(common.InterfaceToStr(v["proposed_id"])),
 			})
 		}
+		if len(data) > 0 {
+			redis.Put(RedisNameNew, "pcIndexNzjProject", data, RedisTimeout+rand.Intn(100))
+		}
 	}
 	return data
 }