|
@@ -10,6 +10,7 @@ import (
|
|
|
"context"
|
|
|
"fmt"
|
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
|
+ "github.com/gogf/gf/v2/os/gctx"
|
|
|
"jy/src/jfw/config"
|
|
|
"jy/src/jfw/jyutil"
|
|
|
"jy/src/jfw/site/jySchool"
|
|
@@ -65,9 +66,12 @@ func (nIndex *NewIndex) NewIndex() error {
|
|
|
nIndex.T[fmt.Sprintf("recommendBid_%d", v)] = GetRecommendBidZone(v, 8)
|
|
|
}
|
|
|
//项目分包
|
|
|
-
|
|
|
+ nIndex.T["projectPackage"] = GetIndexProjectList(6, 8)
|
|
|
//项目专区
|
|
|
-
|
|
|
+ projectZoneType := []int{13, 14, 15, 16}
|
|
|
+ for _, val := range projectZoneType {
|
|
|
+ nIndex.T[fmt.Sprintf("projectZone_%d", val)] = GetIndexProjectList(val, 8)
|
|
|
+ }
|
|
|
//中标喜报
|
|
|
nIndex.T["winnerGlad"] = WinnerGladTidings()
|
|
|
//热门行业 ////重点招标
|
|
@@ -223,13 +227,23 @@ func GetStrategyList() (strategyList []map[string]interface{}) {
|
|
|
return strategyList
|
|
|
}
|
|
|
|
|
|
-func GetIndexProjectList(typ int) []map[string]interface{} {
|
|
|
-
|
|
|
- /*res, err := g.DB().GetOne(ctx, fmt.Sprintf(`SELECT col.bid_id FROM jyseo.%s col WHERE col.seo_id = '%s'`, consts.TableName, seoId))
|
|
|
- if err != nil || res.IsEmpty() {
|
|
|
- return nil
|
|
|
- }*/
|
|
|
- return nil
|
|
|
+func GetIndexProjectList(typ, pageSize int) (data []map[string]interface{}) {
|
|
|
+ redidKey := fmt.Sprintf("pcIndexProjectZone_%d", typ)
|
|
|
+ redisArr, _ := redis.Get("newother", redidKey).([]interface{})
|
|
|
+ if len(redisArr) > 0 {
|
|
|
+ data = common.ObjArrToMapArr(redisArr)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ res, err := g.DB().Query(gctx.New(), fmt.Sprintf(`SELECT nbl.bid_id as bid_id,nbl.title as title,nbl.publish_time as publish_time FROM jyseo_test.new_bid_sign nbs LEFT JOIN jyseo_test.new_bidList nbl ON nbs.bid_id = nbl.bid_id WHERE bitmapContains(sign, %d) ORDER BY publish_time DESC LIMIT %d `, typ, pageSize))
|
|
|
+ if err != nil || res.IsEmpty() {
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ for _, v := range res.List() {
|
|
|
+ v["bid_id"] = encrypt.EncodeArticleId2ByCheck(common.InterfaceToStr(v["bid_id"]))
|
|
|
+ v["publish_time"] = time.Unix(common.Int64All(v["publish_time"]), 0).Format("2006-01-02")
|
|
|
+ data = append(data, v)
|
|
|
+ }
|
|
|
+ return data
|
|
|
}
|
|
|
|
|
|
// 优秀供应商
|