瀏覽代碼

fix:处理领域化搜索404

fuwencai 2 年之前
父節點
當前提交
6e6bebc86a
共有 1 個文件被更改,包括 29 次插入28 次删除
  1. 29 28
      src/jfw/front/supsearch.go

+ 29 - 28
src/jfw/front/supsearch.go

@@ -321,20 +321,7 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
 
 	userId, _ := p.GetSession("userId").(string)
 	baseUserId := p.GetSession("base_user_id")
-	if bidField != "" { // 如果是领域化数据 判断是否是付费用户 是否有权限
-		vipStatus := jy.GetVipState(public.Mysql, public.MQFW, userId)
-		isPayedUser := vipStatus.IsPayedUser()
-		if !isPayedUser {
-			p.T["list"] = []map[string]interface{}{}
-			return p.Render("/pc/supsearch.html", &p.T)
-		}
-		// 是否开通过领域化权益
-		if !jy.HasBidFieldPower(config.ResourceApi.HasPowers, fmt.Sprintf("%v", baseUserId), MedicalFunctionCode) {
-			p.T["list"] = []map[string]interface{}{}
-			return p.Render("/pc/supsearch.html", &p.T)
 
-		}
-	}
 	//高级筛选 仅vip用户可查询
 	var hasBuyerTel, hasWinnerTel string = "", "" //是否有采购单位电话、是否有中标单位电话 y:有 n:没有
 	var buyerclass string = ""                    //采购单位类别
@@ -383,26 +370,40 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
 	var count, totalPage int64
 	secondFlag := ""
 	secondKWS := ""
-	if len(s_word) > 0 || len(industry) > 0 {
-		searchTypeSwitch, _ := config.Sysconfig["searchTypeSwitch"].(bool)
-		status = 2
-		field := bidSearch_field_1
-		if bidField != "" { // 如果是领域化数据
-			field = bidSearch_domain_field_1
+	if bidField != "" { // 如果是领域化数据 判断是否是付费用户 是否有权限
+		vipStatus := jy.GetVipState(public.Mysql, public.MQFW, userId)
+		isPayedUser1 := vipStatus.IsPayedUser()
+		if !isPayedUser1 {
+			list = &[]map[string]interface{}{}
+
+		}
+		// 是否开通过领域化权益
+		if !jy.HasBidFieldPower(config.ResourceApi.HasPowers, fmt.Sprintf("%v", baseUserId), MedicalFunctionCode) {
+			list = &[]map[string]interface{}{}
 		}
-		secondKWS, _, _, _, secondFlag, count, totalPage, list = bidsearch.SearchData("pc", p.Request, 1, util.ObjToString(p.GetSession("userId")), secondKWS, s_word, area, city, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, fileExists, 0, bidsearch.SearchPageSize_PC, true, queryItems, field, notkey, isPayedUser, searchTypeSwitch, bidField)
 	} else {
-		p.DisableHttpCache()
-		pageType := ""
-		// 如果是领域化数据
-		if bidField != "" {
-			if domainPageType, ok := DomainPageType[bidField]; ok {
-				pageType = domainPageType
+		if len(s_word) > 0 || len(industry) > 0 {
+			searchTypeSwitch, _ := config.Sysconfig["searchTypeSwitch"].(bool)
+			status = 2
+			field := bidSearch_field_1
+			if bidField != "" { // 如果是领域化数据
+				field = bidSearch_domain_field_1
+			}
+			secondKWS, _, _, _, secondFlag, count, totalPage, list = bidsearch.SearchData("pc", p.Request, 1, util.ObjToString(p.GetSession("userId")), secondKWS, s_word, area, city, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, fileExists, 0, bidsearch.SearchPageSize_PC, true, queryItems, field, notkey, isPayedUser, searchTypeSwitch, bidField)
+		} else {
+			p.DisableHttpCache()
+			pageType := ""
+			// 如果是领域化数据
+			if bidField != "" {
+				if domainPageType, ok := DomainPageType[bidField]; ok {
+					pageType = domainPageType
+				}
 			}
+			p.T["list"] = PCS_list(pageType) //Newbids("")[0]
+			count, totalPage = 500, 10
 		}
-		p.T["list"] = PCS_list(pageType) //Newbids("")[0]
-		count, totalPage = 500, 10
 	}
+
 	if status == 2 {
 		secondList, tp, _ := bidsearch.LisetData(1, 0, list, secondFlag, config.Seoconfig, isPayedUser)
 		if tp == 1 {