|
@@ -6,6 +6,8 @@ import (
|
|
|
"app.yhyue.com/moapp/jypkg/public"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
+ "strings"
|
|
|
+
|
|
|
//_ "github.com/gogf/gf/contrib/drivers/clickhouse/v2"
|
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
|
"github.com/gogf/gf/v2/os/gctx"
|
|
@@ -41,11 +43,18 @@ type (
|
|
|
Name string
|
|
|
Url string
|
|
|
}
|
|
|
+ keyBidding struct {
|
|
|
+ code string
|
|
|
+ area string
|
|
|
+ city string
|
|
|
+ district string
|
|
|
+ }
|
|
|
)
|
|
|
|
|
|
var (
|
|
|
- siteCodeMap map[string]*KeyWordSiteNode
|
|
|
- specialArea = map[string]bool{"北京": true, "上海": true, "天津": true, "重庆": true}
|
|
|
+ siteCodeMap map[string]*KeyWordSiteNode
|
|
|
+ specialArea = map[string]bool{"北京": true, "上海": true, "天津": true, "重庆": true}
|
|
|
+ KeyBiddingAreaMap []keyBidding
|
|
|
)
|
|
|
|
|
|
func init() {
|
|
@@ -63,6 +72,18 @@ func init() {
|
|
|
siteCodeMap[node.Code] = node
|
|
|
}
|
|
|
}
|
|
|
+ KeyBiddingArea, _ := config.Sysconfig["keyBiddingArea"].(string)
|
|
|
+ resArr, err := g.DB().Query(gctx.New(), fmt.Sprintf(`SELECT area ,city,district,pcode FROM jyseo_test.seo_area_code where class = 4 and area in ('%s') %s`, strings.ReplaceAll(KeyBiddingArea, ",", `','`), `and (district LIKE '%县%' or district LIKE '%市%')`))
|
|
|
+ if err == nil && !resArr.IsEmpty() {
|
|
|
+ for _, m := range resArr.List() {
|
|
|
+ KeyBiddingAreaMap = append(KeyBiddingAreaMap, keyBidding{
|
|
|
+ area: gconv.String(m["area"]),
|
|
|
+ city: gconv.String(m["city"]),
|
|
|
+ district: gconv.String(m["district"]),
|
|
|
+ code: gconv.String(m["pcode"]),
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 政府招标
|
|
@@ -136,6 +157,41 @@ func GovernmentTender(number int) []argument {
|
|
|
return data
|
|
|
}
|
|
|
|
|
|
+// 重点招标区域
|
|
|
+func DistrictsTender(number int) []argument {
|
|
|
+ redisKey := "districtsTender"
|
|
|
+ redisData := redis.Get(RedisNameNew, redisKey)
|
|
|
+ if redisData != nil {
|
|
|
+ if d, err := json.Marshal(redisData); err == nil {
|
|
|
+ var signature []argument
|
|
|
+ json.Unmarshal(d, &signature)
|
|
|
+ return signature
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var (
|
|
|
+ data []argument
|
|
|
+ upperLimit int
|
|
|
+ )
|
|
|
+ areaMap := make(map[string]int)
|
|
|
+ for _, acronym := range KeyBiddingAreaMap {
|
|
|
+ if areaMap[acronym.area] > 2 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ areaMap[acronym.area]++
|
|
|
+ upperLimit++
|
|
|
+ if upperLimit > number {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ data = append(data, argument{
|
|
|
+ fmt.Sprintf("%s%s", acronym.city, acronym.district),
|
|
|
+ fmt.Sprintf("/list/area/%s.html", acronym.code),
|
|
|
+ })
|
|
|
+ }
|
|
|
+ redis.Put(RedisNameNew, redisKey, data, RedisTimeout)
|
|
|
+ return data
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
const (
|
|
|
PSearch_DecMust = `"bidstatus": ["中标","成交","合同","单一"]`
|