浏览代码

feat:快照页面地址中转

wangshan 2 年之前
父节点
当前提交
5ad29024bd
共有 5 个文件被更改,包括 111 次插入76 次删除
  1. 58 57
      src/config.json
  2. 30 6
      src/jfw/front/searchOptimize.go
  3. 9 0
      src/jfw/front/shorturl.go
  4. 5 4
      src/jfw/front/supsearch.go
  5. 9 9
      src/jfw/front/swordfish.go

+ 58 - 57
src/config.json

@@ -8,7 +8,7 @@
     "weixinrpc": "127.0.0.1:8083",
     "cacheflag": false,
     "agreement": "http",
-    "webdomain": "https://web-wky.jydev.jianyu360.com",
+    "webdomain": "https://web-ws.jydev.jianyu360.com",
     "redirect": {
         "searchinfo": "/jylab/mainSearch?msg=0",
         "rssset": "/swordfish/newhistorypush?msg=1",
@@ -334,60 +334,61 @@
 	},
 	"keywordsLimit":35,
 	"detailMosaicTxt":"略",
-    "needMosaic":{
- 		"projectname":true,
-        "projectcode":true,
-        "budget":true,
-        "bidamount":true,
-        "buyer":true,
-        "buyerperson":true,
-        "buyertel":true,
-        "buyeraddr":true,
-        "agency":true,
-        "agencyperson":true,
-        "agencytel":true,
-        "agencyaddr":true,
-        "winner":true,
-        "s_winner":true,
-        "winnerperson":true,
-        "winnertel":true,
-        "winneraddr":true,
-        "docstarttime":true,
-        "docendtime":true,
-        "bidendtime":true,
-        "bidstarttime":true,
-        "bidopentime":true,
-        "bidopenaddress":true,
-        "contractcode":true,
-        "signaturedate":true,
-        "purchasinglist":true,
-        "item":true,
-        "purchasing":true,
-        "itemname":true,
-        "brandname":true,
-        "specs":true,
-        "model":true,
-        "unitname":true,
-        "dimensions":true,
-        "number":true,
-        "unitprice":true,
-        "totalprice":true,
-        "guaranteetime":true,
-        "orderno":true,
-        "procurementlist":true,
-        "projectscope":true,
-        "reserved_amount":true,
-        "expurasingtime":true,
-        "winnerMap":true
-    },
-    "keywordsLimitNologin":25,
-    "messageCenter": {
-      "appid": "10000",
-      "dbName": "messagetest",
-      "interval": 300,
-      "createtime": "2023-01-04 00:00:00",
-      "limitDay": 7,
-      "limitCount": 3
-    },
-    "defaultTotal": 1800000000
+  "needMosaic":{
+  "projectname":true,
+      "projectcode":true,
+      "budget":true,
+      "bidamount":true,
+      "buyer":true,
+      "buyerperson":true,
+      "buyertel":true,
+      "buyeraddr":true,
+      "agency":true,
+      "agencyperson":true,
+      "agencytel":true,
+      "agencyaddr":true,
+      "winner":true,
+      "s_winner":true,
+      "winnerperson":true,
+      "winnertel":true,
+      "winneraddr":true,
+      "docstarttime":true,
+      "docendtime":true,
+      "bidendtime":true,
+      "bidstarttime":true,
+      "bidopentime":true,
+      "bidopenaddress":true,
+      "contractcode":true,
+      "signaturedate":true,
+      "purchasinglist":true,
+      "item":true,
+      "purchasing":true,
+      "itemname":true,
+      "brandname":true,
+      "specs":true,
+      "model":true,
+      "unitname":true,
+      "dimensions":true,
+      "number":true,
+      "unitprice":true,
+      "totalprice":true,
+      "guaranteetime":true,
+      "orderno":true,
+      "procurementlist":true,
+      "projectscope":true,
+      "reserved_amount":true,
+      "expurasingtime":true,
+      "winnerMap":true
+  },
+  "keywordsLimitNologin":25,
+  "messageCenter": {
+    "appid": "10000",
+    "dbName": "messagetest",
+    "interval": 300,
+    "createtime": "2023-01-04 00:00:00",
+    "limitDay": 7,
+    "limitCount": 3
+  },
+  "defaultTotal": 1800000000,
+  "workDesktopUrl":"/page_workDesktop/work-bench/page?link="
 }

+ 30 - 6
src/jfw/front/searchOptimize.go

@@ -201,7 +201,7 @@ func (so *SearchOptimize) SearchParamsHandle() {
 	}
 	//默认搜索范围
 	if so.SelectType == "" {
-		so.SelectType = "title,content"
+		so.SelectType = "title,detail"
 	}
 	//免费用户:高级筛选 采购单位类型、采购单位联系方式、中标企业联系方式、排除词、城市
 	if !so.IsPay {
@@ -309,7 +309,7 @@ func (so *SearchOptimize) GetBidSearchList(isCache bool) (count, total int64, li
 		if repl != nil && *repl != nil && len(*repl) > 0 {
 			//格式化查询结果
 			list = SearchListFormat(so.Industry, *repl, strings.Contains(so.SelectType, "detail"))
-			count = util.If(so.IsPay, bidsearch.SearchMaxPageCount_PAYED, bidsearch.SearchMaxPageCount_PC).(int64)
+			count = util.If(so.IsPay, int64(bidsearch.SearchMaxPageCount_PAYED), int64(bidsearch.SearchMaxPageCount_PC)).(int64)
 			//数据如果>最大数据结果量 total==count,否则count = 付费:5000;免费:500;
 			count = util.If(count > total, total, count).(int64)
 		} else {
@@ -489,12 +489,35 @@ func (so *SearchOptimize) GetBidSearchQuery() string {
 	}
 	//发布时间
 	publishTime := so.PublishTime
-	if publishTime != "" && len(strings.Split(publishTime, "-")) > 1 {
+	if publishTime != "" {
 		if len(query) > 0 {
 			query += ","
 		}
-		startTime := strings.Split(publishTime, "-")[0]
-		endTime := strings.Split(publishTime, "-")[1]
+		startTime, endTime := "", ""
+		now := time.Now()
+		if publishTime == "lately-7" { //最近7天
+			startTime = fmt.Sprint(time.Date(now.Year(), now.Month(), now.Day()-7, 0, 0, 0, 0, time.Local).Unix())
+		} else if publishTime == "lately-30" { //最近30天
+			startTime = fmt.Sprint(time.Date(now.Year(), now.Month(), now.Day()-30, 0, 0, 0, 0, time.Local).Unix())
+		} else if publishTime == "thisyear" { //最近一年
+			startTime = fmt.Sprint(time.Date(now.Year()-1, now.Month(), now.Day(), now.Hour(), now.Minute(), now.Second(), 0, time.Local).Unix())
+			endTime = fmt.Sprint(now.Unix())
+		} else if publishTime == "threeyear" { //最近三年
+			startTime = fmt.Sprint(time.Date(now.Year()-3, now.Month(), now.Day(), now.Hour(), now.Minute(), now.Second(), 0, time.Local).Unix())
+			endTime = fmt.Sprint(now.Unix())
+		} else if publishTime == "fiveyear" { //最近五年
+			startTime = fmt.Sprint(time.Date(now.Year()-5, now.Month(), now.Day(), now.Hour(), now.Minute(), now.Second(), 0, time.Local).Unix())
+			endTime = fmt.Sprint(now.Unix())
+		} else if len(strings.Split(publishTime, "-")) > 1 {
+			startTime = strings.Split(publishTime, "_")[0]
+			endTime = strings.Split(publishTime, "_")[1]
+			etTime := time.Now()
+			if endTime != "" {
+				et, _ := strconv.ParseInt(endTime, 0, 64)
+				etTime = time.Unix(et, 0)
+			}
+			endTime = fmt.Sprint(time.Date(etTime.Year(), etTime.Month(), etTime.Day()+1, 0, 0, 0, 0, time.Local).Unix())
+		}
 		query += `{"range":{"publishtime":{`
 		if startTime != "" {
 			query += `"gte":` + startTime
@@ -673,7 +696,8 @@ func SearchListFormat(industry string, repl []map[string]interface{}, b bool) (l
 			}
 			v["detail"] = detail
 		}
-		v["id"] = util.EncodeArticleId2ByCheck(util.ObjToString(v["id"]))                                          //ME.EncodeArticleId2ByCheck(util.ObjToString((*v)["id"]))                                         //加密信息id
+		v["id"] = util.EncodeArticleId2ByCheck(util.ObjToString(v["_id"])) //加密信息id
+		delete(v, "_id")
 		v["s_subscopeclass"] = IndustryFormat(industry, strings.Trim(util.ObjToString(v["s_subscopeclass"]), ",")) //行业
 		if budget, ok := v["budget"].(float64); ok && budget > 0 {                                                 //预算
 			v["budget"] = int64(budget)

+ 9 - 0
src/jfw/front/shorturl.go

@@ -392,6 +392,15 @@ func (s *Short) Article(stype, id string) error {
 			return s.Redirect(surl)
 		}
 	} else {
+		if !strings.Contains(s.Request.URL.String(), "aside=0") {
+			paramSuffix := "aside=0"
+			if strings.Contains(s.Request.URL.String(), "?") {
+				paramSuffix = fmt.Sprintf("&%s", paramSuffix)
+			} else {
+				paramSuffix = fmt.Sprintf("?%s", paramSuffix)
+			}
+			return s.Redirect(fmt.Sprintf("%s%s%s%s", config.Sysconfig["workDesktopUrl"].(string), config.Sysconfig["webdomain"].(string), url.QueryEscape(s.Request.URL.String()), paramSuffix))
+		}
 		sids := util.CommonDecodeArticle(stype, id)
 		if len(sids) == 0 || (len(sids) > 0 && sids[0] == "") {
 			s.Redirect("/notin/page", 302)

+ 5 - 4
src/jfw/front/supsearch.go

@@ -264,9 +264,9 @@ func (p *Pcsearch) GetNewBids() error {
 		NewUserId: baseUserId,
 	}
 	var (
-		list     []*map[string]interface{}
-		count    int64
-		total, _ = config.Sysconfig["defaultTotal"].(int64)
+		list  []*map[string]interface{}
+		count int64
+		total = util.Int64All(config.Sysconfig["defaultTotal"])
 	)
 	list, count = so.GetBidSearchListByCache()
 	//rs := Newbids(pageType, userId)
@@ -432,6 +432,7 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
 	isLimit := 1
 	if isSearch {
 		searchTypeSwitch, _ := config.Sysconfig["searchTypeSwitch"].(bool)
+		selectType = strings.Join(queryItems, ",")
 		so := NewSearchOptimize(userId, phone, area, city, subtype, toptype, publishtime, selectType, fmt.Sprintf("%s-%s", minprice, maxprice), industry, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, s_word, additionalWords, notkey, "PC", territorialization, 0, pageSize, searchGroup, searchMode, wordsMode, *userInfo, searchTypeSwitch)
 		if len(s_word) > 0 || len(industry) > 0 {
 			if searchLimit {
@@ -452,7 +453,7 @@ func (p *Pcsearch) PcSearchIndex(module string) error {
 				}
 			}
 			list, count = so.GetBidSearchListByCache()
-			total, _ = config.Sysconfig["defaultTotal"].(int64)
+			total = util.Int64All(config.Sysconfig["defaultTotal"])
 		}
 	}
 	if noLoginBl {

+ 9 - 9
src/jfw/front/swordfish.go

@@ -90,13 +90,14 @@ func (m *Front) PcAjaxReq() {
 	if pageSize == 0 {
 		pageSize = 50
 	}
+	//userId = "63c11681800b227df5874680"
 	if tabularflag == "Y" && userId == "" {
 		//判断用户是否登录进行表格查询,否则返回基本数据
 		tabularflag = ""
 	}
-	vipStatus := jy.GetVipState(public.Mysql, public.MQFW, userId)
+	userInfo := jy.GetVipState(public.Mysql, public.MQFW, userId)
 	if territorialization != "" { // 如果是领域化数据 判断是否是付费用户 是否有权限
-		if (vipStatus.BigMember <= 0 && vipStatus.VipState <= 0) || (!jy.HasBidFieldPower(config.ResourceApi.HasPowers, fmt.Sprint(util.Int64All(baseUserId)), MedicalFunctionCode)) {
+		if (userInfo.BigMember <= 0 && userInfo.VipState <= 0) || (!jy.HasBidFieldPower(config.ResourceApi.HasPowers, fmt.Sprint(util.Int64All(baseUserId)), MedicalFunctionCode)) {
 			m.ServeJson(map[string]interface{}{
 				"list": []map[string]interface{}{},
 			})
@@ -109,12 +110,15 @@ func (m *Front) PcAjaxReq() {
 	toptype := m.GetString("toptype") //信息类型
 	publishtime := m.GetString("publishtime")
 	selectType := m.GetString("selectType")
+	if selectType == "" {
+		selectType = "title,content"
+	}
 	industry := strings.TrimSpace(m.GetString("industry"))
 	minprice := m.GetString("minprice")     //最低价格
 	maxprice := m.GetString("maxprice")     //最高价格
 	fileExists := m.GetString("fileExists") //是否有附件--所有用户都可用此功能 0:全部;1:有附件;-1:无附件
 	var (
-		//高级筛选 仅vip用户可查询
+		//高级筛选 仅付费用户可查询
 		hasBuyerTel, hasWinnerTel string //是否有采购单位电话、是否有中标单位电话 y:有 n:没有
 		buyerclass                string //采购单位类别
 		notkey                    string //排除词
@@ -129,14 +133,11 @@ func (m *Front) PcAjaxReq() {
 		wordsMode                 int    //搜索关键词模式;默认0:包含所有关键词;1:包含任意关键词。
 		additionalWords           string //关键词:附加关键词(副:五组,每组最多15个字符 每组,号隔开)
 	)
-	userInfo := jy.GetVipState(public.Mysql, public.MQFW, userId)
 	queryItems = userInfo.GetQueryItems(selectType, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]))
 	isPayedUser = userInfo.IsPayedUser()
-	//isPayedUser, publishtime, queryItems, currentPage, _ = bidsearch.PublicSearch(userId, selectType, publishtime, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]), currentPage, pageSize)
 	if isPayedUser {
 		buyerclass = m.GetString("buyerclass")
 		hasBuyerTel, hasWinnerTel = m.GetString("buyertel"), m.GetString("winnertel")
-		//notkey = m.GetString("notkey")
 		notkey = util.If(strings.Contains(m.GetString("notkey"), ","), strings.ReplaceAll(m.GetString("notkey"), ",", " "), m.GetString("notkey")).(string)
 		city = m.GetString("city")
 		searchGroup, _ = m.GetInteger("searchGroup")     //搜索分组;默认0:全部;1:招标采购搜索;2:超前项目。
@@ -144,7 +145,6 @@ func (m *Front) PcAjaxReq() {
 		wordsMode, _ = m.GetInteger("wordsMode")         //搜索关键词模式;默认0:包含所有关键词;1:包含任意关键词。
 		additionalWords = m.GetString("additionalWords") //关键词:附加关键词(副:五组,每组最多15个字符 每组,号隔开)
 	}
-	m.SetSession("selectType", selectType)
 	if userId == "" {
 		//未登录用户访问全部信息类型 需要过滤掉 拟建和采购意向
 		if subtype == "" {
@@ -168,7 +168,8 @@ func (m *Front) PcAjaxReq() {
 		}
 		if isLimit == 1 {
 			searchTypeSwitch, _ := config.Sysconfig["searchTypeSwitch"].(bool)
-			so := NewSearchOptimize(userId, phone, area, city, subtype, toptype, publishtime, selectType, fmt.Sprintf("%s-%s", minprice, maxprice), industry, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, s_word, additionalWords, notkey, "PC", territorialization, currentPage, pageSize, searchGroup, searchMode, wordsMode, *userInfo, searchTypeSwitch)
+			so := NewSearchOptimize(userId, phone, area, city, subtype, toptype, publishtime, strings.Join(queryItems, ","), fmt.Sprintf("%s-%s", minprice, maxprice), industry, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, s_word, additionalWords, notkey, "PC", territorialization, currentPage, pageSize, searchGroup, searchMode, wordsMode, *userInfo, searchTypeSwitch)
+			m.SetSession("selectType", so.SelectType)
 			count, total, list = so.GetBidSearchList(false)
 		}
 	}
@@ -181,7 +182,6 @@ func (m *Front) PcAjaxReq() {
 		"interceptWord":  a_word,
 		"interceptLimit": util.IntAllDef(config.Sysconfig["keywordsLimit"], 35),
 		"keywords":       b_word,
-		"searchvalue":    a_word,
 	})
 }