renjiaojiao 1 سال پیش
والد
کامیت
c7e770e1bc
1فایلهای تغییر یافته به همراه24 افزوده شده و 27 حذف شده
  1. 24 27
      src/jfw/front/index.go

+ 24 - 27
src/jfw/front/index.go

@@ -6,7 +6,6 @@ import (
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
 	"app.yhyue.com/moapp/jybase/redis"
-	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/bidsearch"
 	"app.yhyue.com/moapp/jypkg/public"
 	"context"
 	"encoding/json"
@@ -113,8 +112,9 @@ func (nIndex *NewIndex) NewIndex() error {
 	//顶部菜单
 	nIndex.T["topMenu"] = g.Cfg("index").MustGet(context.Background(), "topMenu").Maps()
 	//招标公告
+	biddingList, _ := GetRecommendBidZone(5, 8)
 	nIndex.T["newbids"] = map[string]interface{}{
-		"biddingList": NewIndexbids(nIndex.Session(), nIndex.Request),
+		"biddingList": biddingList,
 		"more":        fmt.Sprintf("%s", "/list/stype/ZBGG.html"),
 	}
 	//推荐标讯专区
@@ -226,49 +226,46 @@ func GetRecommendBidZone(typ int, pageSize int) (list []map[string]interface{},
 		typ = 1
 	}
 	rediskey := fmt.Sprintf("pcIndexRecommendBidZone_%d", typ)
-	subtype := ""
+	sql := ""
 	switch typ {
 	case 1:
 		//招标预告
-		subtype = "预告"
 		typs = "招标预告"
+		sql = fmt.Sprintf(" toptype = '%s' ", "预告")
 	case 2:
 		//招标中标成交
-		subtype = "中标,成交"
 		typs = "中标成交"
+		sql = fmt.Sprintf(" subtype = '%s' or subtype = '%s' ", "中标", "成交")
 	case 3:
 		//采购意向
-		subtype = "采购意向"
 		typs = "采购意向"
+		sql = fmt.Sprintf(" toptype = '%s' ", "采购意向")
 	case 4:
 		//拟建
-		subtype = "拟建"
 		typs = "拟建项目"
+		sql = fmt.Sprintf(" toptype = '%s' ", "拟建")
+	case 5:
+		typs = "招标公告"
+		sql = fmt.Sprintf(" toptype = '%s' ", "招标")
 	}
-	if l, ok := redis.Get("newother", rediskey).([]interface{}); ok && l != nil && len(l) > 0 {
+	if l, ok := redis.Get(RedisNameNew, rediskey).([]interface{}); ok && l != nil && len(l) > 0 {
 		list = common.ObjArrToMapArr(l)
+		return list, typs
 	} else {
-		_, _, lists := bidsearch.GetPcBidSearchData("", "", "", "", subtype, "", "", "", "", "", "", "", "", 1, false, nil, bidSearch_field_1, "", false, false, "", pageSize, "")
-		if lists != nil && len(*lists) >= 5 {
-			*lists = (*lists)[0:5]
-			for _, v := range *lists {
-				v["_id"] = encrypt.CommonEncodeArticle("indexcontent", v["_id"].(string))
-				delete(v, "toptype")
-				delete(v, "s_subscopeclass")
-				tmpdate := v["publishtime"]
-				v["publish_time"] = time.Unix(common.Int64All(tmpdate.(float64)), 0).Format("2006-01-02")
-				/*if v["budget"] != nil {
-				  	v["budget"] = ConversionMoeny(v["budget"])
-				  } else if v["bidamount"] != nil {
-				  	v["budget"] = ConversionMoeny(v["bidamount"])
-				  }*/
-			}
+		bidRes, _ := g.DB().Query(gctx.New(), fmt.Sprintf(`SELECT bid_id,title,publish_time FROM new_bidList WHERE %s ORDER BY publish_time DESC limit %d`, sql, pageSize))
+		if bidRes.IsEmpty() {
+			return nil, typs
+		}
+		var finalArr []map[string]interface{}
+		for _, m := range bidRes.List() {
+			m["_id"] = encrypt.EncodeArticleId2ByCheck(common.ObjToString(m["bid_id"]))
+			m["publish_time"] = time.Unix(common.Int64All(m["publish_time"]), 0).Format("2006-01-02")
+			finalArr = append(finalArr, m)
 
-			list = *lists
-			redis.Put("other", rediskey, list, 2*60*60)
 		}
+		redis.Put(RedisNameNew, rediskey, finalArr, 24*3600)
+		return finalArr, typs
 	}
-	return list, typs
 }
 
 // GetStrategyList 招投标攻略
@@ -308,7 +305,7 @@ func GetIndexProjectList(typ, pageSize int) (data []map[string]interface{}, type
 		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))
+	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 new_bid_sign nbs  LEFT JOIN 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, types
 	}