Browse Source

wip:热门标的物按照地市撤回、隐藏城市选择

wangkaiyue 2 years ago
parent
commit
0aaf7b1f65

+ 2 - 1
src/jfw/front/classificationTag.go

@@ -263,7 +263,8 @@ func GetLetterMap(pageSize, pageNum int64, letter string) ([]map[string]interfac
 }
 }
 
 
 func GetIndustry(industryHref string) []map[string]interface{} {
 func GetIndustry(industryHref string) []map[string]interface{} {
-	data := public.BaseMysql.SelectBySql(`select a.id,a.name,b.id class_id,b.name class_1 from seo_words.seo_industry a left join  seo_words.seo_industry_class b on a.class_1=b.name order by a.class_1`)
+	//data := public.BaseMysql.SelectBySql(`select a.id,a.name,b.id class_id,b.name class_1 from seo_words.seo_industry a left join  seo_words.seo_industry_class b on a.class_1=b.name order by a.class_1`)
+	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{}
 	industryArr := []string{}
 	industryMap := map[string][]map[string]interface{}{}
 	industryMap := map[string][]map[string]interface{}{}
 	if len(*data) > 0 && data != nil {
 	if len(*data) > 0 && data != nil {

+ 9 - 45
src/jfw/front/tags.go

@@ -205,7 +205,7 @@ func (this *Tags) Index(types, name string) {
 			//areaHref = fmt.Sprintf("/tags/industry/%s_%s_all.html", info[0], "%v")
 			//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")
 			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{}{
 		crumbsNav1 = map[string]interface{}{
 			"name": fmt.Sprintf("招标行业分类"),
 			"name": fmt.Sprintf("招标行业分类"),
@@ -391,7 +391,7 @@ func (this *Tags) GetkeysMap() []map[string][]map[string]interface{} {
 		for _, v := range *data {
 		for _, v := range *data {
 			name := qu.ObjToString(v["name"])
 			name := qu.ObjToString(v["name"])
 			id := qu.Int64All(v["id"])
 			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 {
 			if r != nil && len(*r) > 0 {
 				for _, vv := range *r {
 				for _, vv := range *r {
 					name2 := qu.ObjToString(vv["name"])
 					name2 := qu.ObjToString(vv["name"])
@@ -410,39 +410,12 @@ func (this *Tags) GetkeysMap() []map[string][]map[string]interface{} {
 	return mar
 	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 {
 	if l := redis.Get("seoCache", rediskey); l != nil {
 		return l
 		return l
 	} else {
 	} 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{}
 		industryArr := []string{}
 		industryMap := map[string][]map[string]interface{}{}
 		industryMap := map[string][]map[string]interface{}{}
 		if len(*data) > 0 && data != nil {
 		if len(*data) > 0 && data != nil {
@@ -519,22 +492,13 @@ func (this *Tags) GetStype(href string) (list []map[string]interface{}) {
 		list = qu.ObjArrToMapArr(l)
 		list = qu.ObjArrToMapArr(l)
 	} else {
 	} else {
 		m := []map[string]interface{}{}
 		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{}
 		codeMap := map[int64][]int64{}
 		level1 := []int64{}
 		level1 := []int64{}
 		nameToCode := map[string]int64{}
 		nameToCode := map[string]int64{}
 		codeToName := map[int64]string{}
 		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"])
 				name := qu.ObjToString(v["name"])
 				pid := qu.Int64All(v["pid"])
 				pid := qu.Int64All(v["pid"])
 				id := qu.Int64All(v["id"])
 				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) {
 func (this *Tags) GetInsturyKeywords(idstr string) (name, class_1, class_2 string) {
 	id, _ := strconv.Atoi(idstr)
 	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 {
 	if data != nil && len(*data) > 0 {
 		for _, v := range *data {
 		for _, v := range *data {
 			class_1 = qu.ObjToString(v["class_1"])
 			class_1 = qu.ObjToString(v["class_1"])

+ 2 - 2
src/web/staticres/tags/js/area-selector.js

@@ -45,7 +45,7 @@ var areaSelector = {
     container.on('click', '.j-button-item.can-expand', function (e) {
     container.on('click', '.j-button-item.can-expand', function (e) {
       var $this = $(this)
       var $this = $(this)
       container.find('.j-button-item.can-expand').removeClass('expand')
       container.find('.j-button-item.can-expand').removeClass('expand')
-      $this.addClass('expand')
+      //$this.addClass('expand')
 
 
       // 删除其他cityList
       // 删除其他cityList
       container.find('.city-list').remove()
       container.find('.city-list').remove()
@@ -105,7 +105,7 @@ var areaSelector = {
     }
     }
 
 
     container.find('.j-button-item.can-expand').removeClass('expand')
     container.find('.j-button-item.can-expand').removeClass('expand')
-    $p.addClass('expand')
+    //$p.addClass('expand')
 
 
     // 删除其他cityList
     // 删除其他cityList
     container.find('.city-list').remove()
     container.find('.city-list').remove()

+ 7 - 7
src/web/templates/pc/tags/template/area-selector.html

@@ -6,13 +6,13 @@
         {{range $k, $v := .T.areaList}}
         {{range $k, $v := .T.areaList}}
             <div class="province-container">
             <div class="province-container">
                 <a class="j-button-item" href="{{$v.url}}" data-p-name="{{$v.name}}">{{$v.name}}</a>
                 <a class="j-button-item" href="{{$v.url}}" data-p-name="{{$v.name}}">{{$v.name}}</a>
-                <div class="city-list" style="display: none">
-                    <div class="city-list-content">
-                        {{range $kk, $vv := $v.area}}
-                            <a class="city-item city" href="{{$vv.url}}" data-p-c-name="{{$v.name}}" data-c-name="{{$vv.name}}">{{$vv.name}}</a>
-                        {{end}}
-                    </div>
-                </div>
+<!--                <div class="city-list" style="display: none">-->
+<!--                    <div class="city-list-content">-->
+<!--                        {{range $kk, $vv := $v.area}}-->
+<!--                            <a class="city-item city" href="{{$vv.url}}" data-p-c-name="{{$v.name}}" data-c-name="{{$vv.name}}">{{$vv.name}}</a>-->
+<!--                        {{end}}-->
+<!--                    </div>-->
+<!--                </div>-->
             </div>
             </div>
         {{end}}
         {{end}}
     </div>
     </div>