Browse Source

feat:列表缓存时间修改

wangkaiyue 1 year ago
parent
commit
44d2bd3936
2 changed files with 3 additions and 3 deletions
  1. 1 1
      internal/consts/vars.go
  2. 2 2
      internal/service/queryStruct.go

+ 1 - 1
internal/consts/vars.go

@@ -12,7 +12,7 @@ var (
 	KeyWordSiteMaxTotal       = g.Cfg().MustGet(context.Background(), "listPageSetting.KeyWordSiteMaxTotal", 300).Int()
 	KeyWordSiteMaxTotal       = g.Cfg().MustGet(context.Background(), "listPageSetting.KeyWordSiteMaxTotal", 300).Int()
 	KeyWordEsMatchingDegree   = g.Cfg().MustGet(context.Background(), "listPageSetting.MatchingDegree", "10%").String()
 	KeyWordEsMatchingDegree   = g.Cfg().MustGet(context.Background(), "listPageSetting.MatchingDegree", "10%").String()
 	KeyWordPinyinMaxTotal     = g.Cfg().MustGet(context.Background(), "listPageSetting.KeyWordPinyinMaxTotal", 300).Int()
 	KeyWordPinyinMaxTotal     = g.Cfg().MustGet(context.Background(), "listPageSetting.KeyWordPinyinMaxTotal", 300).Int()
-	SettingBidCacheTime       = g.Cfg().MustGet(context.Background(), "listPageSetting.cacheTime").Int64()
+	SettingBidCacheTime       = g.Cfg().MustGet(context.Background(), "listPageSetting.cacheTime", 43200).Int64()
 	TopTypeMap                = map[string]string{
 	TopTypeMap                = map[string]string{
 		"招标预告":   "预告",
 		"招标预告":   "预告",
 		"招标公告":   "招标",
 		"招标公告":   "招标",

+ 2 - 2
internal/service/queryStruct.go

@@ -207,7 +207,7 @@ func (query *SeoBiddingQuery) GetDataPageList(ctx context.Context, pageNum, page
 				if i == pageNum {
 				if i == pageNum {
 					res = pageTmp
 					res = pageTmp
 				}
 				}
-				if err := g.Redis().SetEX(ctx, query.getDataPageListCacheKey(i, pageSize, maxTotal, flag), pageTmp, consts.SettingBidCacheTime); err != nil {
+				if err := g.Redis().SetEX(ctx, query.getDataPageListCacheKey(i, pageSize, maxTotal, flag), pageTmp, g.Cfg().MustGet(ctx, "listPageSetting.cacheTime.STypePageHandler", consts.SettingBidCacheTime).Int64()); err != nil {
 					g.Log().Errorf(ctx, "第%d页数据 存储redis err:%v", err)
 					g.Log().Errorf(ctx, "第%d页数据 存储redis err:%v", err)
 				}
 				}
 			}
 			}
@@ -247,7 +247,7 @@ func (query *SeoBiddingQuery) GetOnceData(ctx context.Context, total int, flag s
 		if len(res) > total {
 		if len(res) > total {
 			res = res[:total]
 			res = res[:total]
 		}
 		}
-		if err := g.Redis().SetEX(ctx, cacheKey, res, consts.SettingBidCacheTime); err != nil {
+		if err := g.Redis().SetEX(ctx, cacheKey, res, g.Cfg().MustGet(ctx, "listPageSetting.cacheTime.STypePageHandler", consts.SettingBidCacheTime).Int64()); err != nil {
 			g.Log().Errorf(ctx, "GetOnceData 存储redis err:%v", err)
 			g.Log().Errorf(ctx, "GetOnceData 存储redis err:%v", err)
 		}
 		}
 	} else {
 	} else {