|
@@ -205,7 +205,7 @@ func (this *Tags) Index(types, name string) {
|
|
|
//areaHref = fmt.Sprintf("/tags/industry/%s_%s_all.html", info[0], "%v")
|
|
|
industryHref = fmt.Sprintf("/tags/industry/%s_%s_all_%s.html", "%v", checkedArea, "%v")
|
|
|
//行业标签获取
|
|
|
- this.T["industryList"] = this.GetIndustry(industryHref, checkedProvince, checkedCity) //需要根据地区获取不同的标的物
|
|
|
+ this.T["industryList"] = this.GetIndustry(industryHref) //需要根据地区获取不同的标的物
|
|
|
}
|
|
|
crumbsNav1 = map[string]interface{}{
|
|
|
"name": fmt.Sprintf("招标行业分类"),
|
|
@@ -391,7 +391,7 @@ func (this *Tags) GetkeysMap() []map[string][]map[string]interface{} {
|
|
|
for _, v := range *data {
|
|
|
name := qu.ObjToString(v["name"])
|
|
|
id := qu.Int64All(v["id"])
|
|
|
- r := public.BaseMysql.SelectBySql(`select id,name from seo_words.seo_hot_purchasing where industry =? limit 10`, name)
|
|
|
+ r := public.BaseMysql.SelectBySql(`select id,name from seo_words.seo_industry where class_1 =? limit 10`, name)
|
|
|
if r != nil && len(*r) > 0 {
|
|
|
for _, vv := range *r {
|
|
|
name2 := qu.ObjToString(vv["name"])
|
|
@@ -410,39 +410,12 @@ func (this *Tags) GetkeysMap() []map[string][]map[string]interface{} {
|
|
|
return mar
|
|
|
}
|
|
|
|
|
|
-const industryTagNum = 100
|
|
|
-
|
|
|
-func (this *Tags) GetIndustry(industryHref, province, city string) interface{} {
|
|
|
- rediskey := fmt.Sprintf("pcindex_getIndustry_%s_%s_%s_%d", industryHref, province, city, industryTagNum)
|
|
|
+func (this *Tags) GetIndustry(industryHref string) interface{} {
|
|
|
+ rediskey := fmt.Sprintf("pcindex_getIndustry_%s", industryHref)
|
|
|
if l := redis.Get("seoCache", rediskey); l != nil {
|
|
|
return l
|
|
|
} else {
|
|
|
- //data := public.BaseMysql.SelectBySql(`select a.id,a.name,b.id class_id,b.name class_1 from seo_words.seo_industry a inner join seo_words.seo_industry_class b on a.class_1=b.name and a.class_2 !='药品' order by a.class_1`)
|
|
|
- var filterSql string
|
|
|
-
|
|
|
- if city != "" {
|
|
|
- filterSql += " WHERE city ='" + city + "' "
|
|
|
- } else if province != "" {
|
|
|
- filterSql += " WHERE province ='" + province + "' "
|
|
|
- }
|
|
|
- finalSql := fmt.Sprintf(`
|
|
|
- SELECT ranked.industry as class_1, ranked.name, ranked.total_frequ, ranked.id,b.id AS class_id
|
|
|
- FROM (
|
|
|
- SELECT industry, name, SUM(frequ) AS total_frequ,
|
|
|
- MAX(id) AS id,
|
|
|
- ROW_NUMBER() OVER (PARTITION BY industry ORDER BY SUM(frequ) DESC) AS row_num
|
|
|
- FROM seo_words.seo_hot_purchasing
|
|
|
- %s
|
|
|
- GROUP BY industry, name
|
|
|
- ) AS ranked
|
|
|
- INNER JOIN seo_words.seo_industry_class b
|
|
|
- on ranked.industry=b.name
|
|
|
- WHERE row_num <= %d
|
|
|
- ORDER BY industry, total_frequ DESC;
|
|
|
- `, filterSql, industryTagNum)
|
|
|
- //fmt.Println("finalSql---", finalSql)
|
|
|
- data := public.BaseMysql.SelectBySql(finalSql)
|
|
|
-
|
|
|
+ data := public.BaseMysql.SelectBySql(`select a.id,a.name,b.id class_id,b.name class_1 from seo_words.seo_industry a inner join seo_words.seo_industry_class b on a.class_1=b.name and a.class_2 !='药品' order by a.class_1`)
|
|
|
industryArr := []string{}
|
|
|
industryMap := map[string][]map[string]interface{}{}
|
|
|
if len(*data) > 0 && data != nil {
|
|
@@ -519,22 +492,13 @@ func (this *Tags) GetStype(href string) (list []map[string]interface{}) {
|
|
|
list = qu.ObjArrToMapArr(l)
|
|
|
} else {
|
|
|
m := []map[string]interface{}{}
|
|
|
- var data []map[string]interface{}
|
|
|
- //newData := public.BaseMysql.SelectBySql(`select id,name,pid from seo_words.seo_stype where name = "拟建项目" or name = "采购意向" order by id`)
|
|
|
- //if newData != nil && len(*newData) > 0 {
|
|
|
- // data = append(data, *newData...)
|
|
|
- //}
|
|
|
- //oldData := public.BaseMysql.SelectBySql(`-- select id,name,pid from seo_words.seo_stype where name != "拟建项目" and name != "采购意向" order by id`)
|
|
|
- oldData := public.BaseMysql.SelectBySql(`select id,name,pid from seo_words.seo_stype order by id`)
|
|
|
- if oldData != nil && len(*oldData) > 0 {
|
|
|
- data = append(data, *oldData...)
|
|
|
- }
|
|
|
+ data := public.BaseMysql.SelectBySql(`select id,name,pid from seo_words.seo_stype where name !="拟建项目" and name != "采购意向" and pid=0 order by id`)
|
|
|
codeMap := map[int64][]int64{}
|
|
|
level1 := []int64{}
|
|
|
nameToCode := map[string]int64{}
|
|
|
codeToName := map[int64]string{}
|
|
|
- if len(data) > 0 {
|
|
|
- for _, v := range data {
|
|
|
+ if data != nil && len(*data) > 0 {
|
|
|
+ for _, v := range *data {
|
|
|
name := qu.ObjToString(v["name"])
|
|
|
pid := qu.Int64All(v["pid"])
|
|
|
id := qu.Int64All(v["id"])
|
|
@@ -780,7 +744,7 @@ func (this *Tags) GetSeoKeyWords(id string) (string, string) {
|
|
|
// 获取行业分类下的标签
|
|
|
func (this *Tags) GetInsturyKeywords(idstr string) (name, class_1, class_2 string) {
|
|
|
id, _ := strconv.Atoi(idstr)
|
|
|
- data := public.BaseMysql.SelectBySql(`select id,industry as class_1,industry as class_2,name from seo_words.seo_hot_purchasing where id =?`, id)
|
|
|
+ data := public.BaseMysql.SelectBySql(`select id,class_1,class_2,name from seo_words.seo_industry where id =?`, id)
|
|
|
if data != nil && len(*data) > 0 {
|
|
|
for _, v := range *data {
|
|
|
class_1 = qu.ObjToString(v["class_1"])
|