Переглянути джерело

Merge branch 'feature/v4.9.17_wky' of qmx/jy into feature/v4.9.17

wangkaiyue 1 рік тому
батько
коміт
d51a3c1fd9
2 змінених файлів з 82 додано та 33 видалено
  1. 72 31
      src/jfw/front/supsearch.go
  2. 10 2
      src/jfw/front/swordfish.go

+ 72 - 31
src/jfw/front/supsearch.go

@@ -11,10 +11,10 @@ import (
 	"sync"
 	"time"
 
-	"app.yhyue.com/moapp/jypkg/jylabutil"
-
+	. "app.yhyue.com/moapp/jybase/api"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"app.yhyue.com/moapp/jypkg/jylabutil"
 	"app.yhyue.com/moapp/jypkg/public"
 
 	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/bidsearch"
@@ -31,9 +31,10 @@ import (
 
 type Pcsearch struct {
 	*xweb.Action
-	pcSearchIndex xweb.Mapper `xweb:"/jylab/(supsearch|medical|bi)/index.html"` //搜索首页
-	getNewBids    xweb.Mapper `xweb:"/jylab/supsearch/getNewBids"`              //最新招标信息
-	getstatus     xweb.Mapper `xweb:"/jylab/supsearch/getstatus"`               //实验室开启状态
+	pcSearchIndex xweb.Mapper `xweb:"/jylab/(supsearch|medical|bi)/index.html"`  //搜索首页
+	searchPower   xweb.Mapper `xweb:"/jylab/(supsearch|medical|bi)/searchPower"` //搜索权限页面
+	getNewBids    xweb.Mapper `xweb:"/jylab/supsearch/getNewBids"`               //最新招标信息
+	getstatus     xweb.Mapper `xweb:"/jylab/supsearch/getstatus"`                //实验室开启状态
 	//proposedProject xweb.Mapper `xweb:"/jylab/supsearch/proposedProject.html"`    //拟建项目-- 此功能已取消 影响es 检索功能
 	qr        xweb.Mapper `xweb:"/jylab/supsearch/qr/(.*)"` //生成进入实验室的二维码
 	changePro xweb.Mapper `xweb:"/jylab/changePro"`         //修改提示信息状态
@@ -59,7 +60,10 @@ var (
 )
 
 // MedicalFunctionCode 医疗行业权益代码
-var MedicalFunctionCode = "lyh_yl_ylbxss"
+const (
+	MedicalFunctionCode         = "lyh_yl_ylbxss"
+	MobileTagSearchFunctionCode = "zbcgss_zgydbqjs"
+)
 
 func init() {
 	xweb.AddAction(&Pcsearch{})
@@ -321,6 +325,57 @@ func (p *Pcsearch) GetNewBids() error {
 	return nil
 }
 
+type (
+	SearchItems struct {
+		Key        string                   `json:"key" doc:"提交后端接口时需要的Key: keyword"`
+		Label      string                   `json:"label" doc:"页面展示的标签:关键词"`
+		Type       string                   `json:"type" doc:"操作类型:下拉、时间选择、多选等"`
+		DefaultVal []string                 `json:"defaultVal"`
+		Options    []*SearchItemsValOptions `json:"options" doc:"选项"`
+	}
+	SearchItemsValOptions struct {
+		Key   string `json:"key" doc:"后端接受值"`
+		Label string `json:"label" doc:"展示标签"`
+	}
+)
+
+var (
+	mobileTagItemsValOptions = []*SearchItemsValOptions{
+		{Key: "all", Label: "全部"},
+		{Key: "军队类", Label: "军队类"},
+		{Key: "武警类", Label: "武警类"},
+		{Key: "融通类", Label: "融通类"},
+		{Key: "退役类", Label: "退役类"},
+		{Key: "融办类", Label: "融办类"},
+		{Key: "某某类", Label: "“某某”类"},
+	}
+	mobileTagItemsValOptionsAll = []string{"军队类", "武警类", "融通类", "退役类", "融办类", "某某类"}
+)
+
+// SearchPower 搜索权益列表
+func (p *Pcsearch) SearchPower(module string) {
+	sessVal := p.Session().GetMultiple()
+	userId := util.ObjToString(sessVal["userId"])
+	data, err := func() ([]*SearchItems, error) {
+		var r []*SearchItems
+		switch module {
+		case "supsearch":
+			//搜索页面检索内容
+			if userId != "" && jy.HasBidFieldPower(config.Middleground, p.Session(), MobileTagSearchFunctionCode) {
+				r = append(r, &SearchItems{
+					Key:        "融创",
+					Label:      "mobileTag",
+					Type:       "multiple",
+					DefaultVal: []string{"all"},
+					Options:    mobileTagItemsValOptions,
+				})
+			}
+		}
+		return nil, nil
+	}()
+	p.ServeJson(NewResult(data, err))
+}
+
 // PcSearchIndex 路由搜索
 func (p *Pcsearch) PcSearchIndex(module string) error {
 	defer util.Catch()
@@ -405,6 +460,7 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
 		buyer                     = ""
 		winner                    = ""
 		agency                    = ""
+		mobileTag                 []string //P513中国移动定制招标采购搜索
 	)
 	// 领域化标识
 	territorialization := p.GetString("bid_field")
@@ -417,6 +473,8 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
 		territorialization = territorialization
 	default:
 		territorialization = ""
+		//超级搜索页面 移动定制搜索标签
+		mobileTag = p.GetSlice("mobileTag")
 	}
 	if territorialization == "" {
 		territorialization = p.GetString("property")
@@ -438,29 +496,6 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
 	}
 	//历史导出数据回显
 	if strings.Contains(p.Url(), "?goback") {
-		//keywords = util.ObjToString(p.GetSession("Echo_keywords"))
-		//publishtime = util.ObjToString(p.GetSession("Echo_publishtime"))
-		//area = util.ObjToString(p.GetSession("Echo_area"))
-		//subtype = util.ObjToString(p.GetSession("Echo_subtype"))
-		//minprice = util.ObjToString(p.GetSession("Echo_minprice"))
-		//maxprice = util.ObjToString(p.GetSession("Echo_maxprice"))
-		//buyerclass = util.ObjToString(p.GetSession("Echo_buyerclass"))
-		//selectType = util.ObjToString(p.GetSession("Echo_selectType"))
-		//timeslot = util.ObjToString(p.GetSession("Echo_timeslot"))
-		//hasBuyerTel = util.ObjToString(p.GetSession("Echo_hasBuyertel"))
-		//hasWinnerTel = util.ObjToString(p.GetSession("Echo_hasWinnertel"))
-		//industry = util.ObjToString(p.GetSession("Echo_industry"))
-		//notkey = util.ObjToString(p.GetSession("Echo_notkey"))
-		//fileExists = util.ObjToString(p.GetSession("Echo_fileExists"))
-		//city = util.ObjToString(p.GetSession("Echo_city"))
-		//bidField = util.ObjToString(p.GetSession("Echo_bid_field"))              // 领域化数据 0101-医疗行业
-		//territorialization = util.ObjToString(p.GetSession("Echo_bid_field"))    // 领域化数据 0101-医疗行业
-		//searchGroup = util.IntAll(p.GetSession("Echo_searchGroup"))              //搜索分组;默认0:全部;1:招标采购搜索;2:超前项目。
-		//searchMode = util.IntAll(p.GetSession("Echo_searchMode"))                //搜索模式;默认0:精准模式(不进行系统分词);1:模糊模式(进行系统分词)。
-		//wordsMode = util.IntAll(p.GetSession("Echo_wordsMode"))                  //搜索关键词模式;默认0:包含所有关键词;1:包含任意关键词。
-		//additionalWords = util.ObjToString(p.GetSession("Echo_additionalWords")) //关键词:附加关键词(副:五组,每组最多15个字符 每组,号隔开)
-		//queryItems = userInfo.GetQueryItems(selectType, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]))
-
 		keywords = util.ObjToString(sessVal["Echo_keywords"])
 		publishtime = util.ObjToString(sessVal["Echo_publishtime"])
 		area = util.ObjToString(sessVal["Echo_area"])
@@ -518,6 +553,13 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
 		}
 		b_word, a_word, s_word = jy.InterceptSearchKW(keywords, keywordsLimit, len(industry) == 0)
 	}
+	if len(mobileTag) > 0 { //当无该权限,把此字段置空
+		if !jy.HasBidFieldPower(config.Middleground, p.Session(), MobileTagSearchFunctionCode) {
+			mobileTag = []string{}
+		} else if mobileTag[0] == "all" {
+			mobileTag = mobileTagItemsValOptionsAll
+		}
+	}
 	//医疗领域化信息 用户前提是大会员 超级订阅,才有领域化功能的权限
 	if territorialization != "" && territorialization != "BIProperty" {
 		isSearch = false
@@ -531,7 +573,7 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
 	isLimit := 1
 	if isSearch {
 		searchTypeSwitch, _ := config.Sysconfig["searchTypeSwitch"].(bool)
-		so := NewSearchOptimize(userId, phone, area, city, district, subtype, toptype, publishtime, strings.Join(queryItems, ","), fmt.Sprintf("%s-%s", minprice, maxprice), industry, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, s_word, additionalWords, notkey, "PC", territorialization, "", "", "",
+		so := NewSearchOptimize(mobileTag, userId, phone, area, city, district, subtype, toptype, publishtime, strings.Join(queryItems, ","), fmt.Sprintf("%s-%s", minprice, maxprice), industry, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, s_word, additionalWords, notkey, "PC", territorialization, "", "", "",
 			0, pageSize, searchGroup, searchMode, wordsMode, "", "", 0, 0,
 			*userInfo, searchTypeSwitch, p.Request, accountId, entAccountId, entId, entUserId, buyer, winner, agency)
 		heightKeys = so.HeightKeys //主关键词和附加词合并,多组空格隔开,作为前端渲染高亮关键词使用
@@ -556,7 +598,6 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
 	if noLoginBl {
 		subtype = ""
 	}
-	log.Println("userId:+++", userId)
 	if userId == "" {
 		for _, v := range list {
 			*v = SearchFilter(*v)

+ 10 - 2
src/jfw/front/swordfish.go

@@ -91,6 +91,7 @@ func (m *Front) PcAjaxReq() {
 	phone := util.ObjToString(sessVal["phone"])
 	currentPage, _ := m.GetInteger("pageNumber")
 	pageSize, _ := m.GetInteger("pageSize")
+	mobileTag := m.GetSlice("mobileTag") //P513中国移动定制招标采购搜索
 	if pageSize == 0 {
 		pageSize = 50
 	}
@@ -109,6 +110,13 @@ func (m *Front) PcAjaxReq() {
 			return
 		}
 	}
+	if len(mobileTag) > 0 { //当无该权限,把此字段置空
+		if !jy.HasBidFieldPower(config.Middleground, m.Session(), MobileTagSearchFunctionCode) {
+			mobileTag = []string{}
+		} else if mobileTag[0] == "all" {
+			mobileTag = mobileTagItemsValOptionsAll
+		}
+	}
 	area := m.GetString("area")
 	district := m.GetString("district")
 	subtype := m.GetString("subtype")
@@ -234,7 +242,7 @@ func (m *Front) PcAjaxReq() {
 		}
 		if isLimit == 1 {
 			searchTypeSwitch, _ := config.Sysconfig["searchTypeSwitch"].(bool)
-			so := NewSearchOptimize(userId, phone, area, city, district, subtype, toptype, publishtime, strings.Join(queryItems, ","), fmt.Sprintf("%s-%s", minprice, maxprice), industry, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, s_word, additionalWords, notkey, "PC", territorialization, expireTime, propertyForm, subinformation, currentPage, pageSize, searchGroup, searchMode, wordsMode, period, scale, changehand, isfile, *userInfo, searchTypeSwitch, m.Request, accountId, entAccountId, entId, entUserId, buyer, winner, agency)
+			so := NewSearchOptimize(mobileTag, userId, phone, area, city, district, subtype, toptype, publishtime, strings.Join(queryItems, ","), fmt.Sprintf("%s-%s", minprice, maxprice), industry, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, s_word, additionalWords, notkey, "PC", territorialization, expireTime, propertyForm, subinformation, currentPage, pageSize, searchGroup, searchMode, wordsMode, period, scale, changehand, isfile, *userInfo, searchTypeSwitch, m.Request, accountId, entAccountId, entId, entUserId, buyer, winner, agency)
 			if so.PageNum < 0 && so.PageSize < 0 {
 				log.Printf("查询参数超出范围,有可能是异常请求; 用户id:%s;用户手机号:%s \n", userId, phone)
 			} else {
@@ -245,7 +253,7 @@ func (m *Front) PcAjaxReq() {
 		}
 	} else {
 		searchTypeSwitch, _ := config.Sysconfig["searchTypeSwitch"].(bool)
-		so := NewSearchOptimize(userId, phone, area, city, district, subtype, toptype, publishtime, strings.Join(queryItems, ","), fmt.Sprintf("%s-%s", minprice, maxprice), industry, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, s_word, additionalWords, notkey, "PC", territorialization, expireTime, propertyForm, subinformation, currentPage, pageSize, searchGroup, searchMode, wordsMode, period, scale, changehand, isfile, *userInfo, searchTypeSwitch, m.Request, accountId, entAccountId, entId, entUserId, buyer, winner, agency)
+		so := NewSearchOptimize(mobileTag, userId, phone, area, city, district, subtype, toptype, publishtime, strings.Join(queryItems, ","), fmt.Sprintf("%s-%s", minprice, maxprice), industry, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, s_word, additionalWords, notkey, "PC", territorialization, expireTime, propertyForm, subinformation, currentPage, pageSize, searchGroup, searchMode, wordsMode, period, scale, changehand, isfile, *userInfo, searchTypeSwitch, m.Request, accountId, entAccountId, entId, entUserId, buyer, winner, agency)
 		list, count, total = so.GetBidSearchListByCache()
 	}
 	if userId == "" {