Ver Fonte

fix:首页数据更新规则调整&政府招标展示规则调整

duxin há 5 meses atrás
pai
commit
8829ff1b74
3 ficheiros alterados com 25 adições e 2 exclusões
  1. 21 0
      src/jfw/front/dataServiceArea.go
  2. 1 1
      src/jfw/front/index.go
  3. 3 1
      src/jfw/front/nzjProject.go

+ 21 - 0
src/jfw/front/dataServiceArea.go

@@ -62,11 +62,13 @@ var (
 	specialArea       = map[string]bool{"北京": true, "上海": true, "天津": true, "重庆": true}
 	KeyBiddingAreaMap []keyBidding
 	KeyFwArr          []keyFw
+	KeyJyMap          map[string]string
 	DistrictSArr      []keyFw
 )
 
 func init() {
 	siteCodeMap = make(map[string]*KeyWordSiteNode)
+	KeyJyMap = make(map[string]string)
 	res, err := g.DB().Query(gctx.New(), `SELECT * FROM seo_siteKeywords_splicing order by site_code asc`)
 	if err == nil && len(res.List()) > 0 {
 		for _, m := range res.List() {
@@ -115,6 +117,13 @@ func init() {
 			})
 		}
 	}
+	//区县教育局
+	districtJyResArr, err := g.DB().Query(gctx.New(), `SELECT  alias,keywords  FROM seo_siteKeywords_district where  site_code = 12`)
+	if err == nil && !districtJyResArr.IsEmpty() {
+		for _, m := range districtJyResArr.List() {
+			KeyJyMap[gconv.String(m["alias"])] = gconv.String(m["keywords"])
+		}
+	}
 }
 
 type ClassCode struct {
@@ -219,6 +228,18 @@ func GovernmentTender(number int) []argument {
 			}
 		}
 	}
+	//随机获取10个区县教育局单位
+	var count int
+	for m, n := range KeyJyMap {
+		count++
+		if count > number {
+			break
+		}
+		data = append(data, argument{
+			n,
+			fmt.Sprintf("/list/city/%s_S12.html", m),
+		})
+	}
 	redis.Put(RedisNameNew, redisKey, data, RedisTimeout)
 	return data
 }

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

@@ -266,7 +266,7 @@ func (nIndex *NewIndex) NewIndex() error {
 	//剑鱼课堂
 	nIndex.T["jySchool"] = jyutil.Course(6, 3)
 	// 政府招标
-	nIndex.T["governmentBidding"] = GovernmentTender(15)
+	nIndex.T["governmentBidding"] = GovernmentTender(10)
 	// 服务类采购
 	nIndex.T["serviceProcurement"] = ServiceProcurement(20)
 	//区县招标

+ 3 - 1
src/jfw/front/nzjProject.go

@@ -9,8 +9,10 @@ import (
 	"app.yhyue.com/moapp/jybase/redis"
 	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 	"app.yhyue.com/moapp/jypkg/public"
+	"context"
 	"encoding/json"
 	"fmt"
+	"github.com/gogf/gf/v2/frame/g"
 	"jy/src/jfw/config"
 	"math/rand"
 	"sort"
@@ -743,7 +745,7 @@ func NewHotEnt(isWinner bool, number int) (data []map[string]interface{}) {
 		} else {
 			data = redisData
 		}
-		redis.Put("newother", redisKey, data, RedisTimeout)
+		redis.Put("newother", redisKey, data, g.Cfg("index").MustGet(context.Background(), "indexBiddingCacheTime", 1800).Int())
 	}
 	return
 }