|
@@ -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: "mobileTag",
|
|
|
+ Label: "融创",
|
|
|
+ Type: "multiple",
|
|
|
+ DefaultVal: append(mobileTagItemsValOptionsAll, "all"), //默认选择全部
|
|
|
+ Options: mobileTagItemsValOptions,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return r, 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")
|
|
@@ -438,29 +494,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 +551,18 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
|
|
|
}
|
|
|
b_word, a_word, s_word = jy.InterceptSearchKW(keywords, keywordsLimit, len(industry) == 0)
|
|
|
}
|
|
|
+ if strings.Index(p.Refer(), "/page_workDesktop/work-bench") > -1 {
|
|
|
+ //超级搜索页面 移动定制搜索标签(仅工作台内展示)
|
|
|
+ mobileTag = p.GetSlice("mobileTag[]")
|
|
|
+ //if len(mobileTag) > 0 { //当无该权限,把此字段置空
|
|
|
+ if !jy.HasBidFieldPower(config.Middleground, p.Session(), MobileTagSearchFunctionCode) {
|
|
|
+ mobileTag = []string{}
|
|
|
+ } else if (len(mobileTag) > 0 && mobileTag[0] == "all") || len(mobileTag) == 0 {
|
|
|
+ mobileTag = mobileTagItemsValOptionsAll
|
|
|
+ }
|
|
|
+ //}
|
|
|
+ }
|
|
|
+
|
|
|
//医疗领域化信息 用户前提是大会员 超级订阅,才有领域化功能的权限
|
|
|
if territorialization != "" && territorialization != "BIProperty" {
|
|
|
isSearch = false
|
|
@@ -531,14 +576,14 @@ 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 //主关键词和附加词合并,多组空格隔开,作为前端渲染高亮关键词使用
|
|
|
//关键词 行业 附加词
|
|
|
//放开用户不输入关键词可搜索 --P297需求
|
|
|
// p329 反爬白名单用户放开 非反爬白名单用户不放开未输入关键词
|
|
|
- if len(s_word) > 0 || (len(s_word) == 0 && onList) || len(industry) > 0 || strings.TrimSpace(so.AdditionalWords) != "" {
|
|
|
+ if len(s_word) > 0 || (len(s_word) == 0 && onList) || len(industry) > 0 || strings.TrimSpace(so.AdditionalWords) != "" || len(so.MobileTag) > 0 {
|
|
|
if searchLimit {
|
|
|
isLimit = public.Lst.IsLimited(p.Request, p.ResponseWriter, p.Session(), isPayedUser)
|
|
|
if isLimit == 1 { //没有被限制
|
|
@@ -556,7 +601,6 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
|
|
|
if noLoginBl {
|
|
|
subtype = ""
|
|
|
}
|
|
|
- log.Println("userId:+++", userId)
|
|
|
if userId == "" {
|
|
|
for _, v := range list {
|
|
|
*v = SearchFilter(*v)
|