|
@@ -1,304 +1,304 @@
|
|
package front
|
|
package front
|
|
|
|
|
|
import (
|
|
import (
|
|
- "app.yhyue.com/moapp/jybase/common"
|
|
|
|
- "app.yhyue.com/moapp/jybase/redis"
|
|
|
|
- "app.yhyue.com/moapp/jypkg/public"
|
|
|
|
- "encoding/json"
|
|
|
|
- "fmt"
|
|
|
|
- "jy/src/jfw/jyutil"
|
|
|
|
- "math/rand"
|
|
|
|
- "strings"
|
|
|
|
- //_ "github.com/gogf/gf/contrib/drivers/clickhouse/v2"
|
|
|
|
- "github.com/gogf/gf/v2/frame/g"
|
|
|
|
- "github.com/gogf/gf/v2/os/gctx"
|
|
|
|
- "github.com/gogf/gf/v2/util/gconv"
|
|
|
|
- "jy/src/jfw/config"
|
|
|
|
|
|
+ "app.yhyue.com/moapp/jybase/common"
|
|
|
|
+ "app.yhyue.com/moapp/jybase/redis"
|
|
|
|
+ "app.yhyue.com/moapp/jypkg/public"
|
|
|
|
+ "encoding/json"
|
|
|
|
+ "fmt"
|
|
|
|
+ "jy/src/jfw/jyutil"
|
|
|
|
+ "math/rand"
|
|
|
|
+ "strings"
|
|
|
|
+ //_ "github.com/gogf/gf/contrib/drivers/clickhouse/v2"
|
|
|
|
+ "github.com/gogf/gf/v2/frame/g"
|
|
|
|
+ "github.com/gogf/gf/v2/os/gctx"
|
|
|
|
+ "github.com/gogf/gf/v2/util/gconv"
|
|
|
|
+ "jy/src/jfw/config"
|
|
)
|
|
)
|
|
|
|
|
|
// HotIndustryAndRegion 热门行业/地区年度招标趋势
|
|
// HotIndustryAndRegion 热门行业/地区年度招标趋势
|
|
func HomeBiddingTrends() []config.IndustryTrend {
|
|
func HomeBiddingTrends() []config.IndustryTrend {
|
|
- return config.IndustryTrendConfig
|
|
|
|
|
|
+ return config.IndustryTrendConfig
|
|
}
|
|
}
|
|
|
|
|
|
type (
|
|
type (
|
|
- KeyWordSiteRoot struct {
|
|
|
|
- SiteCodeMap map[string]*KeyWordSiteNode //省份直辖市简称对照
|
|
|
|
- SiteArr []*KeyWordSiteNode
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- KeyWordSiteNode struct {
|
|
|
|
- Code string `json:"code" doc:"代码"`
|
|
|
|
- Alias string `json:"alias" doc:"名称"`
|
|
|
|
- AreaKeyWord string `json:"areaKeyword" doc:"省份关键词"`
|
|
|
|
- CityKeyWord string `json:"cityKeyword" doc:"城市关键词"`
|
|
|
|
- CitySpecialKeyWord string `json:"citySpecialKeyword" doc:"直辖市关键词"`
|
|
|
|
- NotShowCityCode map[string]bool `json:"notShowCityCode" doc:"不展示的城市,因数据量少"`
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- KeyWordSiteShow struct {
|
|
|
|
- Code string `json:"code" doc:"代码"`
|
|
|
|
- Name string `json:"name" doc:"名称"`
|
|
|
|
- //KeyWord string `json:"keyWord" doc:"对应关键词"`
|
|
|
|
- }
|
|
|
|
- argument struct {
|
|
|
|
- Name string
|
|
|
|
- Url string
|
|
|
|
- }
|
|
|
|
- keyBidding struct {
|
|
|
|
- code string
|
|
|
|
- area string
|
|
|
|
- city string
|
|
|
|
- district string
|
|
|
|
- }
|
|
|
|
- keyFw struct {
|
|
|
|
- code string
|
|
|
|
- keyword string
|
|
|
|
- }
|
|
|
|
|
|
+ KeyWordSiteRoot struct {
|
|
|
|
+ SiteCodeMap map[string]*KeyWordSiteNode //省份直辖市简称对照
|
|
|
|
+ SiteArr []*KeyWordSiteNode
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ KeyWordSiteNode struct {
|
|
|
|
+ Code string `json:"code" doc:"代码"`
|
|
|
|
+ Alias string `json:"alias" doc:"名称"`
|
|
|
|
+ AreaKeyWord string `json:"areaKeyword" doc:"省份关键词"`
|
|
|
|
+ CityKeyWord string `json:"cityKeyword" doc:"城市关键词"`
|
|
|
|
+ CitySpecialKeyWord string `json:"citySpecialKeyword" doc:"直辖市关键词"`
|
|
|
|
+ NotShowCityCode map[string]bool `json:"notShowCityCode" doc:"不展示的城市,因数据量少"`
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ KeyWordSiteShow struct {
|
|
|
|
+ Code string `json:"code" doc:"代码"`
|
|
|
|
+ Name string `json:"name" doc:"名称"`
|
|
|
|
+ //KeyWord string `json:"keyWord" doc:"对应关键词"`
|
|
|
|
+ }
|
|
|
|
+ argument struct {
|
|
|
|
+ Name string
|
|
|
|
+ Url string
|
|
|
|
+ }
|
|
|
|
+ keyBidding struct {
|
|
|
|
+ code string
|
|
|
|
+ area string
|
|
|
|
+ city string
|
|
|
|
+ district string
|
|
|
|
+ }
|
|
|
|
+ keyFw struct {
|
|
|
|
+ code string
|
|
|
|
+ keyword string
|
|
|
|
+ }
|
|
)
|
|
)
|
|
|
|
|
|
var (
|
|
var (
|
|
- siteCodeMap map[string]*KeyWordSiteNode
|
|
|
|
- specialArea = map[string]bool{"北京": true, "上海": true, "天津": true, "重庆": true}
|
|
|
|
- KeyBiddingAreaMap []keyBidding
|
|
|
|
- KeyFwArr []keyFw
|
|
|
|
- KeyJyMap map[string]string
|
|
|
|
- DistrictSArr []keyFw
|
|
|
|
|
|
+ siteCodeMap map[string]*KeyWordSiteNode
|
|
|
|
+ specialArea = map[string]bool{"北京": true, "上海": true, "天津": true, "重庆": true}
|
|
|
|
+ KeyBiddingAreaMap []keyBidding
|
|
|
|
+ KeyFwArr []keyFw
|
|
|
|
+ KeyJyMap map[string]string
|
|
|
|
+ DistrictSArr []keyFw
|
|
)
|
|
)
|
|
|
|
|
|
func init() {
|
|
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() {
|
|
|
|
- notShowCityCodeMap := map[string]bool{}
|
|
|
|
- for _, cityCode := range strings.Split(gconv.String(m["notShowCityCode"]), ",") {
|
|
|
|
- notShowCityCodeMap[cityCode] = true
|
|
|
|
- }
|
|
|
|
- node := &KeyWordSiteNode{
|
|
|
|
- Code: fmt.Sprintf("S%s", gconv.String(m["site_code"])),
|
|
|
|
- Alias: gconv.String(m["alias"]),
|
|
|
|
- AreaKeyWord: gconv.String(m["area"]),
|
|
|
|
- CityKeyWord: gconv.String(m["city"]),
|
|
|
|
- CitySpecialKeyWord: gconv.String(m["city_special"]),
|
|
|
|
- NotShowCityCode: notShowCityCodeMap,
|
|
|
|
- }
|
|
|
|
- siteCodeMap[node.Code] = node
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- KeyBiddingArea, _ := config.Sysconfig["keyBiddingArea"].(string)
|
|
|
|
- resArr, err := g.DB().Query(gctx.New(), fmt.Sprintf(`SELECT area ,city,district,pcode FROM seo_area_code where state = 1 and 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"]),
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- districtSData, err := g.DB().Query(gctx.New(), `SELECT site_code,keywords,alias FROM seo_siteKeywords_district where site_code = 1 `)
|
|
|
|
- if err == nil && !districtSData.IsEmpty() {
|
|
|
|
- for _, m := range districtSData.List() {
|
|
|
|
- DistrictSArr = append(DistrictSArr, keyFw{
|
|
|
|
- keyword: gconv.String(m["keywords"]),
|
|
|
|
- code: fmt.Sprintf("%s_S%d", m["alias"], m["site_code"]),
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- fwResArr, err := g.DB().Query(gctx.New(), `SELECT id, keyword FROM new_keyword_unified where unifiedSign = 'fw' and state = 1`)
|
|
|
|
- if err == nil && !fwResArr.IsEmpty() {
|
|
|
|
- for _, m := range fwResArr.List() {
|
|
|
|
- KeyFwArr = append(KeyFwArr, keyFw{
|
|
|
|
- keyword: gconv.String(m["keyword"]),
|
|
|
|
- code: gconv.String(m["id"]),
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //区县教育局
|
|
|
|
- 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"])
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ 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() {
|
|
|
|
+ notShowCityCodeMap := map[string]bool{}
|
|
|
|
+ for _, cityCode := range strings.Split(gconv.String(m["notShowCityCode"]), ",") {
|
|
|
|
+ notShowCityCodeMap[cityCode] = true
|
|
|
|
+ }
|
|
|
|
+ node := &KeyWordSiteNode{
|
|
|
|
+ Code: fmt.Sprintf("S%s", gconv.String(m["site_code"])),
|
|
|
|
+ Alias: gconv.String(m["alias"]),
|
|
|
|
+ AreaKeyWord: gconv.String(m["area"]),
|
|
|
|
+ CityKeyWord: gconv.String(m["city"]),
|
|
|
|
+ CitySpecialKeyWord: gconv.String(m["city_special"]),
|
|
|
|
+ NotShowCityCode: notShowCityCodeMap,
|
|
|
|
+ }
|
|
|
|
+ siteCodeMap[node.Code] = node
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ KeyBiddingArea, _ := config.Sysconfig["keyBiddingArea"].(string)
|
|
|
|
+ resArr, err := g.DB().Query(gctx.New(), fmt.Sprintf(`SELECT area ,city,district,pcode FROM seo_area_code where state = 1 and 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"]),
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ districtSData, err := g.DB().Query(gctx.New(), `SELECT site_code,keywords,alias FROM seo_siteKeywords_district where site_code = 1 `)
|
|
|
|
+ if err == nil && !districtSData.IsEmpty() {
|
|
|
|
+ for _, m := range districtSData.List() {
|
|
|
|
+ DistrictSArr = append(DistrictSArr, keyFw{
|
|
|
|
+ keyword: gconv.String(m["keywords"]),
|
|
|
|
+ code: fmt.Sprintf("%s_S%d/", m["alias"], m["site_code"]),
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ fwResArr, err := g.DB().Query(gctx.New(), `SELECT id, keyword FROM new_keyword_unified where unifiedSign = 'fw' and state = 1`)
|
|
|
|
+ if err == nil && !fwResArr.IsEmpty() {
|
|
|
|
+ for _, m := range fwResArr.List() {
|
|
|
|
+ KeyFwArr = append(KeyFwArr, keyFw{
|
|
|
|
+ keyword: gconv.String(m["keyword"]),
|
|
|
|
+ code: gconv.String(m["id"]),
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //区县教育局
|
|
|
|
+ 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 {
|
|
type ClassCode struct {
|
|
- Class int
|
|
|
|
- Code string
|
|
|
|
- Url string
|
|
|
|
|
|
+ Class int
|
|
|
|
+ Code string
|
|
|
|
+ Url string
|
|
}
|
|
}
|
|
|
|
|
|
// 政府招标
|
|
// 政府招标
|
|
func GovernmentTender(number int) []argument {
|
|
func GovernmentTender(number int) []argument {
|
|
- redisKey := "governmentTender"
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- areaM := make(map[string]ClassCode)
|
|
|
|
- res, err := g.DB().Query(gctx.New(), `SELECT area,city,pcode,class FROM seo_area_code where state = 1 and (class = 1 or class = 2 or class = 3)`)
|
|
|
|
- if !res.IsEmpty() && len(res.List()) > 0 && err == nil {
|
|
|
|
- for _, v := range res.List() {
|
|
|
|
- switch common.IntAll(v["class"]) {
|
|
|
|
- case 1, 3:
|
|
|
|
- name := common.ObjToString(v["area"])
|
|
|
|
- areaM[name] = ClassCode{
|
|
|
|
- Class: common.IntAll(v["class"]),
|
|
|
|
- Code: common.ObjToString(v["pcode"]),
|
|
|
|
- Url: "/list/area/%s_%s",
|
|
|
|
- }
|
|
|
|
- default:
|
|
|
|
- name := common.ObjToString(v["city"])
|
|
|
|
- areaM[name] = ClassCode{
|
|
|
|
- Class: common.IntAll(v["class"]),
|
|
|
|
- Code: common.ObjToString(v["pcode"]),
|
|
|
|
- Url: "/list/city/%s_%s",
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- var (
|
|
|
|
- data []argument
|
|
|
|
- upperLimit int
|
|
|
|
- )
|
|
|
|
- siteCode := make(map[string]bool)
|
|
|
|
- for name, acronym := range areaM {
|
|
|
|
- upperLimit++
|
|
|
|
- if upperLimit > number {
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
- if len(siteCode) < len(siteCodeMap) {
|
|
|
|
- for code, node := range siteCodeMap {
|
|
|
|
- var tagName string
|
|
|
|
- if node.NotShowCityCode[acronym.Code] {
|
|
|
|
- continue
|
|
|
|
- }
|
|
|
|
- if !siteCode[code] {
|
|
|
|
- if node.Alias != "" {
|
|
|
|
- tagName = node.Alias
|
|
|
|
- } else {
|
|
|
|
- switch acronym.Class {
|
|
|
|
- case 1:
|
|
|
|
- tagName = node.AreaKeyWord
|
|
|
|
- case 2:
|
|
|
|
- tagName = node.CityKeyWord
|
|
|
|
- case 3:
|
|
|
|
- tagName = node.CitySpecialKeyWord
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- data = append(data, argument{
|
|
|
|
- fmt.Sprintf("%s%s", name, tagName),
|
|
|
|
- fmt.Sprintf(acronym.Url, acronym.Code, code),
|
|
|
|
- })
|
|
|
|
- siteCode[code] = true
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- for code, node := range siteCodeMap {
|
|
|
|
- var tagName string
|
|
|
|
- if node.NotShowCityCode[acronym.Code] {
|
|
|
|
- continue
|
|
|
|
- }
|
|
|
|
- if node.Alias != "" {
|
|
|
|
- tagName = node.Alias
|
|
|
|
- } else {
|
|
|
|
- switch acronym.Class {
|
|
|
|
- case 1:
|
|
|
|
- tagName = node.AreaKeyWord
|
|
|
|
- case 2:
|
|
|
|
- tagName = node.CityKeyWord
|
|
|
|
- case 3:
|
|
|
|
- tagName = node.CitySpecialKeyWord
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- data = append(data, argument{
|
|
|
|
- fmt.Sprintf("%s%s", name, tagName),
|
|
|
|
- fmt.Sprintf(acronym.Url, acronym.Code, code),
|
|
|
|
- })
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //随机获取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", m),
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- if len(data) > 0 {
|
|
|
|
- redis.Put(RedisNameNew, redisKey, data, RedisTimeout)
|
|
|
|
- }
|
|
|
|
- return data
|
|
|
|
|
|
+ redisKey := "governmentTender"
|
|
|
|
+ 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
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ areaM := make(map[string]ClassCode)
|
|
|
|
+ res, err := g.DB().Query(gctx.New(), `SELECT area,city,pcode,class FROM seo_area_code where state = 1 and (class = 1 or class = 2 or class = 3)`)
|
|
|
|
+ if !res.IsEmpty() && len(res.List()) > 0 && err == nil {
|
|
|
|
+ for _, v := range res.List() {
|
|
|
|
+ switch common.IntAll(v["class"]) {
|
|
|
|
+ case 1, 3:
|
|
|
|
+ name := common.ObjToString(v["area"])
|
|
|
|
+ areaM[name] = ClassCode{
|
|
|
|
+ Class: common.IntAll(v["class"]),
|
|
|
|
+ Code: common.ObjToString(v["pcode"]),
|
|
|
|
+ Url: "/list/area/%s_%s",
|
|
|
|
+ }
|
|
|
|
+ default:
|
|
|
|
+ name := common.ObjToString(v["city"])
|
|
|
|
+ areaM[name] = ClassCode{
|
|
|
|
+ Class: common.IntAll(v["class"]),
|
|
|
|
+ Code: common.ObjToString(v["pcode"]),
|
|
|
|
+ Url: "/list/city/%s_%s",
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ var (
|
|
|
|
+ data []argument
|
|
|
|
+ upperLimit int
|
|
|
|
+ )
|
|
|
|
+ siteCode := make(map[string]bool)
|
|
|
|
+ for name, acronym := range areaM {
|
|
|
|
+ upperLimit++
|
|
|
|
+ if upperLimit > number {
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ if len(siteCode) < len(siteCodeMap) {
|
|
|
|
+ for code, node := range siteCodeMap {
|
|
|
|
+ var tagName string
|
|
|
|
+ if node.NotShowCityCode[acronym.Code] {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ if !siteCode[code] {
|
|
|
|
+ if node.Alias != "" {
|
|
|
|
+ tagName = node.Alias
|
|
|
|
+ } else {
|
|
|
|
+ switch acronym.Class {
|
|
|
|
+ case 1:
|
|
|
|
+ tagName = node.AreaKeyWord
|
|
|
|
+ case 2:
|
|
|
|
+ tagName = node.CityKeyWord
|
|
|
|
+ case 3:
|
|
|
|
+ tagName = node.CitySpecialKeyWord
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ data = append(data, argument{
|
|
|
|
+ fmt.Sprintf("%s%s", name, tagName),
|
|
|
|
+ fmt.Sprintf(acronym.Url, acronym.Code, code),
|
|
|
|
+ })
|
|
|
|
+ siteCode[code] = true
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ for code, node := range siteCodeMap {
|
|
|
|
+ var tagName string
|
|
|
|
+ if node.NotShowCityCode[acronym.Code] {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ if node.Alias != "" {
|
|
|
|
+ tagName = node.Alias
|
|
|
|
+ } else {
|
|
|
|
+ switch acronym.Class {
|
|
|
|
+ case 1:
|
|
|
|
+ tagName = node.AreaKeyWord
|
|
|
|
+ case 2:
|
|
|
|
+ tagName = node.CityKeyWord
|
|
|
|
+ case 3:
|
|
|
|
+ tagName = node.CitySpecialKeyWord
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ data = append(data, argument{
|
|
|
|
+ fmt.Sprintf("%s%s", name, tagName),
|
|
|
|
+ fmt.Sprintf(acronym.Url, acronym.Code, code),
|
|
|
|
+ })
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //随机获取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/", m),
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if len(data) > 0 {
|
|
|
|
+ redis.Put(RedisNameNew, redisKey, data, RedisTimeout)
|
|
|
|
+ }
|
|
|
|
+ return data
|
|
}
|
|
}
|
|
|
|
|
|
// 重点招标区域
|
|
// 重点招标区域
|
|
func DistrictsTender(number int) []argument {
|
|
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
|
|
|
|
- )
|
|
|
|
- for _, i2 := range jyutil.GenerateRandomNumber(0, len(KeyBiddingAreaMap), number) {
|
|
|
|
- acronym := KeyBiddingAreaMap[i2]
|
|
|
|
- data = append(data, argument{
|
|
|
|
- common.If(strings.Contains(acronym.district, "区"), fmt.Sprintf("%s%s", acronym.city, acronym.district), acronym.district).(string),
|
|
|
|
- fmt.Sprintf("/list/city/%s.html", acronym.code),
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- if data != nil && len(data) > 0 {
|
|
|
|
- redis.Put(RedisNameNew, redisKey, data, RedisTimeout)
|
|
|
|
- }
|
|
|
|
- return data
|
|
|
|
|
|
+ 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
|
|
|
|
+ )
|
|
|
|
+ for _, i2 := range jyutil.GenerateRandomNumber(0, len(KeyBiddingAreaMap), number) {
|
|
|
|
+ acronym := KeyBiddingAreaMap[i2]
|
|
|
|
+ data = append(data, argument{
|
|
|
|
+ common.If(strings.Contains(acronym.district, "区"), fmt.Sprintf("%s%s", acronym.city, acronym.district), acronym.district).(string),
|
|
|
|
+ fmt.Sprintf("/list/city/%s.html", acronym.code),
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if data != nil && len(data) > 0 {
|
|
|
|
+ redis.Put(RedisNameNew, redisKey, data, RedisTimeout)
|
|
|
|
+ }
|
|
|
|
+ return data
|
|
}
|
|
}
|
|
|
|
|
|
func DistrictsSList(number int) []argument {
|
|
func DistrictsSList(number int) []argument {
|
|
- redisKey := "districtsSList"
|
|
|
|
- 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
|
|
|
|
- )
|
|
|
|
- for _, i2 := range jyutil.GenerateRandomNumber(0, len(DistrictSArr), number) {
|
|
|
|
- acronym := DistrictSArr[i2]
|
|
|
|
- data = append(data, argument{
|
|
|
|
- acronym.keyword,
|
|
|
|
- fmt.Sprintf("/list/city/%s/", acronym.code),
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- if data != nil && len(data) > 0 {
|
|
|
|
- redis.Put(RedisNameNew, redisKey, data, RedisTimeout)
|
|
|
|
- }
|
|
|
|
- return data
|
|
|
|
|
|
+ redisKey := "districtsSList"
|
|
|
|
+ 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
|
|
|
|
+ )
|
|
|
|
+ for _, i2 := range jyutil.GenerateRandomNumber(0, len(DistrictSArr), number) {
|
|
|
|
+ acronym := DistrictSArr[i2]
|
|
|
|
+ data = append(data, argument{
|
|
|
|
+ acronym.keyword,
|
|
|
|
+ fmt.Sprintf("/list/city/%s/", acronym.code),
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ if data != nil && len(data) > 0 {
|
|
|
|
+ redis.Put(RedisNameNew, redisKey, data, RedisTimeout)
|
|
|
|
+ }
|
|
|
|
+ return data
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -488,53 +488,53 @@ func Quarter() time.Time {
|
|
|
|
|
|
// 热门采购数据
|
|
// 热门采购数据
|
|
func PurchasingData() []map[string]interface{} {
|
|
func PurchasingData() []map[string]interface{} {
|
|
- redisData, _ := redis.Get(RedisNameNew, "hotPurchasingData").([]interface{})
|
|
|
|
- if len(redisData) > 0 {
|
|
|
|
- return common.ObjArrToMapArr(redisData)
|
|
|
|
- }
|
|
|
|
- var keyWords []map[string]interface{}
|
|
|
|
- data := public.BaseMysql.SelectBySql("SELECT keyword FROM data_supermarket GROUP BY keyword")
|
|
|
|
- if data != nil && len(*data) > 0 {
|
|
|
|
- listData := []map[string]interface{}{}
|
|
|
|
- if len(*data) > 30 {
|
|
|
|
- r := rand.Intn(len(*data) - 30)
|
|
|
|
- listData = (*data)[r : r+30]
|
|
|
|
- } else {
|
|
|
|
- listData = *data
|
|
|
|
- }
|
|
|
|
- for _, m := range listData {
|
|
|
|
- keyWords = append(keyWords, map[string]interface{}{
|
|
|
|
- "keyword": common.InterfaceToStr(m["keyword"]),
|
|
|
|
- "url": fmt.Sprintf("/datasmt/index_1?searchValue=%s", common.InterfaceToStr(m["keyword"])),
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- redis.Put(RedisNameNew, "hotPurchasingData", keyWords, RedisTimeout)
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return keyWords
|
|
|
|
|
|
+ redisData, _ := redis.Get(RedisNameNew, "hotPurchasingData").([]interface{})
|
|
|
|
+ if len(redisData) > 0 {
|
|
|
|
+ return common.ObjArrToMapArr(redisData)
|
|
|
|
+ }
|
|
|
|
+ var keyWords []map[string]interface{}
|
|
|
|
+ data := public.BaseMysql.SelectBySql("SELECT keyword FROM data_supermarket GROUP BY keyword")
|
|
|
|
+ if data != nil && len(*data) > 0 {
|
|
|
|
+ listData := []map[string]interface{}{}
|
|
|
|
+ if len(*data) > 30 {
|
|
|
|
+ r := rand.Intn(len(*data) - 30)
|
|
|
|
+ listData = (*data)[r : r+30]
|
|
|
|
+ } else {
|
|
|
|
+ listData = *data
|
|
|
|
+ }
|
|
|
|
+ for _, m := range listData {
|
|
|
|
+ keyWords = append(keyWords, map[string]interface{}{
|
|
|
|
+ "keyword": common.InterfaceToStr(m["keyword"]),
|
|
|
|
+ "url": fmt.Sprintf("/datasmt/index_1?searchValue=%s", common.InterfaceToStr(m["keyword"])),
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ redis.Put(RedisNameNew, "hotPurchasingData", keyWords, RedisTimeout)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return keyWords
|
|
}
|
|
}
|
|
|
|
|
|
// ServiceProcurement 服务类采购
|
|
// ServiceProcurement 服务类采购
|
|
func ServiceProcurement(number int) []argument {
|
|
func ServiceProcurement(number int) []argument {
|
|
- redisKey := "ServiceProcurement"
|
|
|
|
- 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
|
|
|
|
- )
|
|
|
|
- for _, i2 := range jyutil.GenerateRandomNumber(0, len(KeyFwArr), number) {
|
|
|
|
- acronym := KeyFwArr[i2]
|
|
|
|
- data = append(data, argument{
|
|
|
|
- acronym.keyword,
|
|
|
|
- fmt.Sprintf("/fuwu/fw%03s.html", acronym.code),
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- redis.Put(RedisNameNew, redisKey, data, RedisTimeout)
|
|
|
|
- return data
|
|
|
|
|
|
+ redisKey := "ServiceProcurement"
|
|
|
|
+ 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
|
|
|
|
+ )
|
|
|
|
+ for _, i2 := range jyutil.GenerateRandomNumber(0, len(KeyFwArr), number) {
|
|
|
|
+ acronym := KeyFwArr[i2]
|
|
|
|
+ data = append(data, argument{
|
|
|
|
+ acronym.keyword,
|
|
|
|
+ fmt.Sprintf("/fuwu/fw%03s.html", acronym.code),
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ redis.Put(RedisNameNew, redisKey, data, RedisTimeout)
|
|
|
|
+ return data
|
|
}
|
|
}
|