wangchuanjin 5 years ago
parent
commit
e824ae85ad

+ 1 - 1
src/jfw/front/supsearch.go

@@ -275,7 +275,7 @@ func (p *Pcsearch) PcSearchIndex() error {
 		}
 		//所有的再次分词查询 只查标题
 		if len([]rune(s_word)) > 3 && int(count) < pc_pageSize {
-			secondKWS = public.HttpEs(s_word, "ik_smart", public.DbConf.Elasticsearch.Main.Address)
+			secondKWS = jy.HttpEs(s_word, "ik_smart", public.DbConf.Elasticsearch.Main.Address)
 			findfields := `"title"`
 			qstr := getSearchQuery(secondKWS, industry, minprice, maxprice, findfields, getBidSearchQuery(area, publishtime, subtype))
 			secondLimit := 2*pc_pageSize - int(count)

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

@@ -505,7 +505,7 @@ func (m *Front) PcAjaxReq() {
 					listSize = len(*list)
 				}
 				if len([]rune(s_word)) > 3 && int(count) < pc_pageSize && start == 0 {
-					secondKWS = public.HttpEs(s_word, "ik_smart", public.DbConf.Elasticsearch.Main.Address)
+					secondKWS = jy.HttpEs(s_word, "ik_smart", public.DbConf.Elasticsearch.Main.Address)
 					findfields := `"title"`
 					qstr := getSearchQuery(secondKWS, industry, minprice, maxprice, findfields, getBidSearchQuery(area, publishtime, subtype))
 					secondLimit := 2*pc_pageSize - int(count)
@@ -872,7 +872,7 @@ func (m *Front) WxsearchlistPaging() {
 					listSize = len(*list)
 				}
 				if len([]rune(s_word)) > 3 && listSize < pc_pageSize && pageNum == 1 {
-					secondKWS = public.HttpEs(s_word, "ik_smart", public.DbConf.Elasticsearch.Main.Address)
+					secondKWS = jy.HttpEs(s_word, "ik_smart", public.DbConf.Elasticsearch.Main.Address)
 					findfields := `"title"`
 					qstr := getSearchQuery(secondKWS, industry, minprice, maxprice, findfields, getBidSearchQuery(scope, publishtime, subtype))
 					secondLimit := 2*pc_pageSize - listSize

+ 1 - 1
src/jfw/modules/app/src/app/front/swordfish.go

@@ -470,7 +470,7 @@ func (m *Front) WxsearchlistPaging() {
 					listSize = len(*list)
 				}
 				if len([]rune(s_word)) > 3 && listSize < wx_pageSize && pageNum == 1 {
-					secondKWS = public.HttpEs(s_word, "ik_smart", public.DbConf.Elasticsearch.Main.Address)
+					secondKWS = jy.HttpEs(s_word, "ik_smart", public.DbConf.Elasticsearch.Main.Address)
 					findfields := `"title"`
 					qstr := getSearchQuery(secondKWS, industry, minprice, maxprice, findfields, getBidSearchQuery(scope, publishtime, subtype))
 					secondLimit := 2*wx_pageSize - listSize

+ 11 - 13
src/jfw/modules/app/src/web/staticres/jyapp/js/searchindex.js

@@ -1503,9 +1503,8 @@ var SuperSearch = {
 	    ListHtmlObj.on("tap", function(event){
 	        var h = $(this).find("a.bt").attr("s");
 	        var sid = $(this).find("a.bt").attr("sid");
-	        var sds = SuperSearch.s_words.replace(/\+/g,"+");
 			var industry = $(this).find(".industry").text();
-	        SuperSearch.myredirect(h,sid,sds,industry);
+	        SuperSearch.myredirect(h,sid,industry);
 	    });
 	    $('#supersearchPage #list').append(ListHtmlObj);
 		$(".loading_").hide();
@@ -1513,9 +1512,8 @@ var SuperSearch = {
 //	    TableHtmlobj.on("tap",function(event){
 //	        var h = $(this).attr("s");
 //	        var sid = $(this).attr("sid");
-//	        var sds = SuperSearch.s_words.replace(/\+/g,"+");
 //			var industry = $(this).attr("i");
-//	        SuperSearch.myredirect(h,sid,sds,industry);
+//	        SuperSearch.myredirect(h,sid,industry);
 //	    });
 //	    $("#supersearchPage #table .content").append(TableHtmlobj);
 	},
@@ -1553,18 +1551,16 @@ var SuperSearch = {
 	   	ListHtmlObj.on("tap", function(event){
 	       var h = $(this).find("a.bt").attr("s");
 	       var sid = $(this).find("a.bt").attr("sid");
-	       var sds = SuperSearch.s_words.replace(/\+/g,"+");
 		   var industry = $(this).find(".industry").text();
-	       SuperSearch.myredirect(h,sid,sds,industry);
+	       SuperSearch.myredirect(h,sid,industry);
 	   	});
 	   	$('#supersearchPage #list').html(ListHtmlObj);
 
 	   	TableHtmlobj.on("tap",function(event){
 	       	var h =  $(this).attr("s");
 	       	var sid = $(this).attr("sid");
-	       	var sds = SuperSearch.s_words.replace(/\+/g,"+");
 			var industry = $(this).attr("i");
-	       	SuperSearch.myredirect(h,sid,sds,industry);
+	       	SuperSearch.myredirect(h,sid,industry);
 	   	});
 	  	if(SuperSearch.subtype_proposed==SuperSearch.reqParam.subtype){
 	       	$("#supersearchPage #table .content").html("<tr><td><div>序号</div></td><td><div style='width: 100px;'>项目代码</div></td><td><div style='width: 207px;'>项目名称</div></td><td><div style='width: 200px;'>审批事项</div></td><td><div style='width: 75px;'>审批结果</div></td><td><div style='width: 75px;'>审批时间</div></td><td><div style='width: 75px;'>发布时间</div></td></tr>");
@@ -1574,7 +1570,7 @@ var SuperSearch = {
 	   	$("#supersearchPage #table .content").append(TableHtmlobj);
 		$(".loading_").hide();
 	},
-	myredirect: function (link,sid,sds,industry){  //跳转三级页
+	myredirect: function (link,sid,industry){  //跳转三级页
 		//保存当前页面至sessionStorage
 		SuperSearch.setSessionStorage();
 		if(userId == ""||userId == null){
@@ -1582,6 +1578,10 @@ var SuperSearch = {
 			return;
 		}
 		if(sid!=undefined){
+			var sds = SuperSearch.s_words;
+			if(SuperSearch.secondFlag=="T"&&SuperSearch.secondKWS!=null&&SuperSearch.secondKWS!=""&&SuperSearch.secondKWS!=undefined){
+				sds = SuperSearch.secondKWS;
+			}
 			//跳转
 			link = link.replace(/\n/g,"");
 			if(link!=""&&!/^http/.test(link)){
@@ -1890,9 +1890,8 @@ var SuperSearch = {
 				ListContent.on("tap", function(event){
 				    var h = $(this).find("a.bt").attr("s");
 				    var sid = $(this).find("a.bt").attr("sid");
-				    var sds = SuperSearch.s_words.replace(/\+/g,"+");
 					var industry = $(this).find(".industry").text();
-				    SuperSearch.myredirect(h,sid,sds,industry);
+				    SuperSearch.myredirect(h,sid,industry);
 				});
 				$("#supersearchPage #list").html(ListContent);
 				//
@@ -1900,9 +1899,8 @@ var SuperSearch = {
 				TableContent.on("tap",function(event){
 				    var h =  $(this).attr("s");
 				    var sid = $(this).attr("sid");
-				    var sds = SuperSearch.s_words.replace(/\+/g,"+");
 					var industry = $(this).attr("i");
-				    SuperSearch.myredirect(h,sid,sds,industry);
+				    SuperSearch.myredirect(h,sid,industry);
 				});
 				$("#supersearchPage #table .data .content").html(TableContent);
 				//

+ 11 - 13
src/jfw/modules/app/src/web/staticres/jyapp/js/wxSupersearch.js

@@ -1242,9 +1242,8 @@ var SuperSearch = {
 	    ListHtmlObj.on("tap", function(event){
 	        var h = $(this).find("a.bt").attr("s");
 	        var sid = $(this).find("a.bt").attr("sid");
-	        var sds = SuperSearch.s_words.replace(/\+/g,"+");
 			var industry = $(this).find(".industry").text();
-	        SuperSearch.myredirect(h,sid,sds,industry);
+	        SuperSearch.myredirect(h,sid,industry);
 	    });
 	    $('#supersearchPage #list').append(ListHtmlObj);	
 		$(".loading_").hide();
@@ -1252,9 +1251,8 @@ var SuperSearch = {
 //	    TableHtmlobj.on("tap",function(event){
 //	        var h = $(this).attr("s");
 //	        var sid = $(this).attr("sid");
-//	        var sds = SuperSearch.s_words.replace(/\+/g,"+");
 //			var industry = $(this).attr("i");
-//	        SuperSearch.myredirect(h,sid,sds,industry);
+//	        SuperSearch.myredirect(h,sid,industry);
 //	    });
 //	    $("#supersearchPage #table .content").append(TableHtmlobj);
 	},
@@ -1292,18 +1290,16 @@ var SuperSearch = {
 	   	ListHtmlObj.on("tap", function(event){
 	       var h = $(this).find("a.bt").attr("s");
 	       var sid = $(this).find("a.bt").attr("sid");
-	       var sds = SuperSearch.s_words.replace(/\+/g,"+");
 		   var industry = $(this).find(".industry").text();
-	       SuperSearch.myredirect(h,sid,sds,industry);
+	       SuperSearch.myredirect(h,sid,industry);
 	   	});
 	   	$('#supersearchPage #list').html(ListHtmlObj);
 	
 	   	TableHtmlobj.on("tap",function(event){
 	       	var h =  $(this).attr("s");
 	       	var sid = $(this).attr("sid");
-	       	var sds = SuperSearch.s_words.replace(/\+/g,"+");
 			var industry = $(this).attr("i");
-	       	SuperSearch.myredirect(h,sid,sds,industry);
+	       	SuperSearch.myredirect(h,sid,industry);
 	   	});
 	  	if(SuperSearch.subtype_proposed==SuperSearch.reqParam.subtype){
 	       	$("#supersearchPage #table .content").html("<tr><td><div>序号</div></td><td><div style='width: 100px;'>项目代码</div></td><td><div style='width: 207px;'>项目名称</div></td><td><div style='width: 200px;'>审批事项</div></td><td><div style='width: 75px;'>审批结果</div></td><td><div style='width: 75px;'>审批时间</div></td><td><div style='width: 75px;'>发布时间</div></td></tr>");
@@ -1313,7 +1309,7 @@ var SuperSearch = {
 	   	$("#supersearchPage #table .content").append(TableHtmlobj);
 		$(".loading_").hide();
 	},
-	myredirect: function (link,sid,sds,industry){  //跳转三级页
+	myredirect: function (link,sid,industry){  //跳转三级页
 		//保存当前页面至sessionStorage
 		SuperSearch.setSessionStorage();
 		if(userId == ""||userId == null){
@@ -1321,6 +1317,10 @@ var SuperSearch = {
 			return;
 		}
 		if(sid!=undefined){
+			var sds = SuperSearch.s_words;
+			if(SuperSearch.secondFlag=="T"&&SuperSearch.secondKWS!=null&&SuperSearch.secondKWS!=""&&SuperSearch.secondKWS!=undefined){
+				sds = SuperSearch.secondKWS;
+			}
 			//跳转
 			link = link.replace(/\n/g,"");
 			if(link!=""&&!/^http/.test(link)){
@@ -1629,9 +1629,8 @@ var SuperSearch = {
 				ListContent.on("tap", function(event){
 				    var h = $(this).find("a.bt").attr("s");
 				    var sid = $(this).find("a.bt").attr("sid");
-				    var sds = SuperSearch.s_words.replace(/\+/g,"+");
 					var industry = $(this).find(".industry").text();
-				    SuperSearch.myredirect(h,sid,sds,industry);
+				    SuperSearch.myredirect(h,sid,industry);
 				});
 				$("#supersearchPage #list").html(ListContent);
 				//
@@ -1639,9 +1638,8 @@ var SuperSearch = {
 				TableContent.on("tap",function(event){
 				    var h =  $(this).attr("s");
 				    var sid = $(this).attr("sid");
-				    var sds = SuperSearch.s_words.replace(/\+/g,"+");
 					var industry = $(this).attr("i");
-				    SuperSearch.myredirect(h,sid,sds,industry);
+				    SuperSearch.myredirect(h,sid,industry);
 				});
 				$("#supersearchPage #table .data .content").html(TableContent);
 				//

+ 43 - 18
src/jfw/modules/common/src/qfw/util/jy/jy.go

@@ -1,10 +1,12 @@
 package jy
 
 import (
+	"crypto/rand"
 	"encoding/json"
 	"fmt"
 	"io/ioutil"
 	"log"
+	"math/big"
 	"net/http"
 	"net/url"
 	"qfw/util"
@@ -81,9 +83,14 @@ func InterceptSearchKW(word string, isIntercept, isFilter bool) (b_word, a_word,
 	return
 }
 
-//
 func HttpEs(ques, analyzer, esAddress string) (res string) {
-	surl := esAddress + "/bidding/_analyze"
+	var addrs []string
+	surl := ""
+	for _, s := range strings.Split(esAddress, ",") {
+		addrs = append(addrs, s)
+	}
+	i, _ := rand.Int(rand.Reader, big.NewInt(int64(len(addrs)))) //随机
+	surl = addrs[int(i.Int64())] + "/bidding/_analyze"
 	URL, _ := url.Parse(surl)
 	Q := URL.Query()
 	Q.Add("text", ques)
@@ -91,29 +98,47 @@ func HttpEs(ques, analyzer, esAddress string) (res string) {
 	URL.RawQuery = Q.Encode()
 	resp, err := http.Get(URL.String())
 	if err != nil {
-		log.Println("err1:")
-	} else {
-		result, err := ioutil.ReadAll(resp.Body)
-		if err == nil {
-			defer resp.Body.Close()
-			var resmap map[string]interface{}
-			json.Unmarshal(result, &resmap)
-			if resmap != nil {
-				tokens := util.ObjArrToMapArr(resmap["tokens"].([]interface{}))
-				for k, v := range tokens {
-					if FilteKey(util.ObjToString(v["token"])) != "" {
-						if k > 0 {
-							res += "+"
-						}
-						res += util.ObjToString(v["token"])
-					}
+		log.Println("es连接失败 err1:", err)
+		resp, err = getesResp(ques, analyzer, addrs)
+		if err != nil {
+			return
+		}
+	}
+	result, err := ioutil.ReadAll(resp.Body)
+	if err == nil {
+		defer resp.Body.Close()
+		var resmap map[string]interface{}
+		json.Unmarshal(result, &resmap)
+		if resmap != nil {
+			tokens := util.ObjArrToMapArr(resmap["tokens"].([]interface{}))
+			for k, v := range tokens {
+				if k > 0 {
+					res += "+"
 				}
+				res += util.ObjToString(v["token"])
 			}
 		}
 	}
 	return
 }
 
+//
+func getesResp(ques, analyzer string, addrs []string) (resp *http.Response, err error) {
+	for _, v := range addrs {
+		surl := v + "/bidding/_analyze"
+		URL, _ := url.Parse(surl)
+		Q := URL.Query()
+		Q.Add("text", ques)
+		Q.Add("analyzer", analyzer)
+		URL.RawQuery = Q.Encode()
+		resp, err = http.Get(URL.String())
+		if err == nil {
+			break
+		}
+	}
+	return resp, err
+}
+
 //发送邮箱验证码
 func SendMailIdentCode(to, code string, auth []*mail.GmailAuth) bool {
 	html := fmt.Sprintf(`<div>

+ 3 - 2
src/jfw/modules/subscribepay/src/entity/dataExportSearch.go

@@ -7,6 +7,7 @@ import (
 	"log"
 	qutil "qfw/util"
 	"qfw/util/elastic"
+	"qfw/util/jy"
 	"strconv"
 	"strings"
 	"sync"
@@ -303,7 +304,7 @@ func GetDataExportSearchCountUseId(_id string) (count int) {
 				if count > 0 {
 					res = doSearch(qstr, 0, count, "")
 				}
-				secondKWS := util.HttpEs(scd.Keyword[0].Keyword, "ik_smart", config.Config.Elasticsearch)
+				secondKWS := jy.HttpEs(scd.Keyword[0].Keyword, "ik_smart", config.Config.Elasticsearch)
 				scd.Keyword[0].Keyword = secondKWS
 				scd.SelectType = "title"
 				qstr = getDataExportSql(scd)
@@ -398,7 +399,7 @@ func GetDataExportSearchResultUseId(_id, dataType string, count int) (*[]map[str
 			searchTextSize = len([]rune(scd.Keyword[0].Keyword))
 		}
 		if searchTextSize > 3 && num < 50 {
-			secondKWS := util.HttpEs(scd.Keyword[0].Keyword, "ik_smart", config.Config.Elasticsearch)
+			secondKWS := jy.HttpEs(scd.Keyword[0].Keyword, "ik_smart", config.Config.Elasticsearch)
 			scd.Keyword[0].Keyword = secondKWS
 			scd.SelectType = "title"
 			qstr = getDataExportSql(scd)

+ 2 - 1
src/jfw/modules/subscribepay/src/entity/dataexport.go

@@ -10,6 +10,7 @@ import (
 	"log"
 	"os"
 	qutil "qfw/util"
+	"qfw/util/jy"
 	"qfw/util/mail"
 	"regexp"
 	"strconv"
@@ -311,7 +312,7 @@ func SendNotice(order *map[string]interface{}, order_money float64, pay_time, do
 	url := fmt.Sprintf("%s%s", config.Config.WebDomain, download_url)
 	for _, audit := range ExConf.AuditPersons {
 		if regexp.MustCompile("^\\d+$").MatchString(audit) {
-			util.SendSMS("2828100", audit, map[string]string{
+			jy.SendSMS("2828100", audit, map[string]string{
 				"name":     order_code,
 				"username": user_mail,
 				"tel":      url,

+ 7 - 10
src/jfw/modules/subscribepay/src/service/vipSubscribeTrial.go

@@ -4,22 +4,19 @@ import (
 	"encoding/json"
 	"entity"
 	"errors"
+	"log"
 	"pay"
+	qutil "qfw/util"
+	"qfw/util/jy"
 	"regexp"
-
-	"github.com/dchest/captcha"
-	"github.com/go-xweb/httpsession"
-	"gopkg.in/mgo.v2/bson"
-
-	"log"
-
 	"strings"
 	"time"
 	"util"
 
-	qutil "qfw/util"
-
+	"github.com/dchest/captcha"
+	"github.com/go-xweb/httpsession"
 	"github.com/go-xweb/xweb"
+	"gopkg.in/mgo.v2/bson"
 )
 
 //试用用户
@@ -133,7 +130,7 @@ func (t *TrialOrder) SendPhoneCaptcha() {
 		t.SetSession("subvip_trial_lastSend", time.Now().Unix())
 		log.Printf("%s 发送短信验证码 %s\n", t.GetSession("userId"), MsgCode)
 		go func() {
-			util.SendSMS("2828060", phoneNum, map[string]string{"code": MsgCode})
+			jy.SendSMS("2828060", phoneNum, map[string]string{"code": MsgCode})
 		}()
 		return true, ""
 	}()

+ 0 - 92
src/jfw/modules/subscribepay/src/util/public.go

@@ -1,47 +1,13 @@
 package util
 
 import (
-	"crypto/rand"
-	"encoding/json"
 	"fmt"
-	"io/ioutil"
-	"log"
-	"math/big"
-	"net/http"
-	"net/url"
 	qutil "qfw/util"
-	"qfw/util/sms"
-	"regexp"
 	"strings"
 )
 
 var Se_Topnet = qutil.SimpleEncrypt{Key: "topnet"}
 
-var filterReg_3 = regexp.MustCompile("(项目|公告|公示)$")
-var filterReg_2 = regexp.MustCompile("^[)\\)>》】\\]}}〕,,;;::'\"“”。.\\??、/+=\\_—*&……\\^%$¥@!!`~·(\\(<《【\\[{{〔]+$")
-var filterReg_1 = regexp.MustCompile("^([0-9]{1,3}|[零一二三四五六七八九十]{1,2}|联系人?|电话|地址|编号|采购|政府采购|成交|更正|招标|中标|变更|结果)$")
-var filterReg = regexp.MustCompile("^[的人号时元万公告项目地址电话邮编日期联系招标中结果成交项目项目采购采购项目政府采购公告更正公告]+$")
-
-func FilteKey(k string) string {
-	k = strings.TrimSpace(k)
-	k = filterReg_3.ReplaceAllString(k, "")
-	k = filterReg_2.ReplaceAllString(k, "")
-	k = filterReg_1.ReplaceAllString(k, "")
-	k = filterReg.ReplaceAllString(k, "")
-	return k
-}
-
-//根据模板发送短信,模板是运营商设定的。
-//第三个参数是可变参数,可以传入多个,但要和模板相匹配
-func SendSMS(tplcode /*模板代码*/, mobile /*手机号码*/ string, param map[string]string) {
-	tmp := []string{}
-	for k, v := range param {
-		tmp = append(tmp, "#"+k+"#="+v)
-	}
-	text := strings.Join(tmp, "&")
-	sms.SendSms(mobile, tplcode, text)
-}
-
 /*
  * 结果列表转换,目前只换行行业字段
  * 所有的招标搜索都要调用此方法,列表中有展示行业的也可以用
@@ -111,61 +77,3 @@ func GetMyPhone(userId string) string {
 	}
 	return ""
 }
-
-func HttpEs(ques, analyzer, esAddress string) (res string) {
-	var addrs []string
-	surl := ""
-	for _, s := range strings.Split(esAddress, ",") {
-		addrs = append(addrs, s)
-	}
-	i, _ := rand.Int(rand.Reader, big.NewInt(int64(len(addrs)))) //随机
-	surl = addrs[int(i.Int64())] + "/bidding/_analyze"
-	URL, _ := url.Parse(surl)
-	Q := URL.Query()
-	Q.Add("text", ques)
-	Q.Add("analyzer", analyzer)
-	URL.RawQuery = Q.Encode()
-	resp, err := http.Get(URL.String())
-	if err != nil {
-		log.Println("es连接失败 err1:", err)
-		resp, err = getesResp(ques, analyzer, addrs)
-		if err != nil {
-			return
-		}
-	}
-	result, err := ioutil.ReadAll(resp.Body)
-	if err == nil {
-		defer resp.Body.Close()
-		var resmap map[string]interface{}
-		json.Unmarshal(result, &resmap)
-		if resmap != nil {
-			tokens := qutil.ObjArrToMapArr(resmap["tokens"].([]interface{}))
-			for k, v := range tokens {
-				if FilteKey(qutil.ObjToString(v["token"])) != "" {
-					if k > 0 {
-						res += "+"
-					}
-					res += qutil.ObjToString(v["token"])
-				}
-			}
-		}
-	}
-	return
-}
-
-//
-func getesResp(ques, analyzer string, addrs []string) (resp *http.Response, err error) {
-	for _, v := range addrs {
-		surl := v + "/bidding/_analyze"
-		URL, _ := url.Parse(surl)
-		Q := URL.Query()
-		Q.Add("text", ques)
-		Q.Add("analyzer", analyzer)
-		URL.RawQuery = Q.Encode()
-		resp, err = http.Get(URL.String())
-		if err == nil {
-			break
-		}
-	}
-	return resp, err
-}

+ 0 - 63
src/jfw/public/public.go

@@ -1,14 +1,9 @@
 package public
 
 import (
-	"crypto/rand"
 	"encoding/json"
 	"fmt"
-	"io/ioutil"
-	"log"
-	"math/big"
 	"net/http"
-	"net/url"
 	. "qfw/mongodb"
 	"qfw/util"
 	"qfw/util/elastic"
@@ -247,64 +242,6 @@ func MapArrSortMerge(arr1, arr2 []map[string]interface{}, mergeFiled, sortFiled
 	// return &tmp
 }
 
-func HttpEs(ques, analyzer, esAddress string) (res string) {
-	var addrs []string
-	surl := ""
-	for _, s := range strings.Split(esAddress, ",") {
-		addrs = append(addrs, s)
-	}
-	i, _ := rand.Int(rand.Reader, big.NewInt(int64(len(addrs)))) //随机
-	surl = addrs[int(i.Int64())] + "/bidding/_analyze"
-	URL, _ := url.Parse(surl)
-	Q := URL.Query()
-	Q.Add("text", ques)
-	Q.Add("analyzer", analyzer)
-	URL.RawQuery = Q.Encode()
-	resp, err := http.Get(URL.String())
-	if err != nil {
-		log.Println("es连接失败 err1:", err)
-		resp, err = getesResp(ques, analyzer, addrs)
-		if err != nil {
-			return
-		}
-	}
-	result, err := ioutil.ReadAll(resp.Body)
-	if err == nil {
-		defer resp.Body.Close()
-		var resmap map[string]interface{}
-		json.Unmarshal(result, &resmap)
-		if resmap != nil {
-			tokens := util.ObjArrToMapArr(resmap["tokens"].([]interface{}))
-			for k, v := range tokens {
-				if FilteKey(util.ObjToString(v["token"])) != "" {
-					if k > 0 {
-						res += "+"
-					}
-					res += util.ObjToString(v["token"])
-				}
-			}
-		}
-	}
-	return
-}
-
-//
-func getesResp(ques, analyzer string, addrs []string) (resp *http.Response, err error) {
-	for _, v := range addrs {
-		surl := v + "/bidding/_analyze"
-		URL, _ := url.Parse(surl)
-		Q := URL.Query()
-		Q.Add("text", ques)
-		Q.Add("analyzer", analyzer)
-		URL.RawQuery = Q.Encode()
-		resp, err = http.Get(URL.String())
-		if err == nil {
-			break
-		}
-	}
-	return resp, err
-}
-
 //保存用户搜索日志
 func SaveUserSearchLog(request *http.Request, userid string, count int64, platform, source string, condition map[string]interface{}) {
 	go func() {

+ 3 - 2
src/jfw/public/search.go

@@ -6,6 +6,7 @@ import (
 	"log"
 	"qfw/util"
 	"qfw/util/elastic"
+	"qfw/util/jy"
 	"qfw/util/redis"
 	"sort"
 	"strconv"
@@ -284,7 +285,7 @@ func GetDataExportSearchCountUseId(_id string) (count int) {
 				if count > 0 {
 					res = doSearch(qstr, 0, count, "")
 				}
-				secondKWS := HttpEs(scd.Keyword[0].Keyword, "ik_smart", DbConf.Elasticsearch.Main.Address)
+				secondKWS := jy.HttpEs(scd.Keyword[0].Keyword, "ik_smart", DbConf.Elasticsearch.Main.Address)
 				scd.Keyword[0].Keyword = secondKWS
 				scd.SelectType = "title"
 				qstr = getDataExportSql(scd)
@@ -366,7 +367,7 @@ func GetDataExportSearchResultUseId(_id, dataType string, count int) (*[]map[str
 			if count > 0 {
 				res = doSearch(qstr, 0, count, "")
 			}
-			secondKWS := HttpEs(scd.Keyword[0].Keyword, "ik_smart", DbConf.Elasticsearch.Main.Address)
+			secondKWS := jy.HttpEs(scd.Keyword[0].Keyword, "ik_smart", DbConf.Elasticsearch.Main.Address)
 			scd.Keyword[0].Keyword = secondKWS
 			scd.SelectType = "title"
 			qstr = getDataExportSql(scd)

+ 11 - 13
src/web/staticres/js/wxSupersearch.js

@@ -1429,18 +1429,16 @@ var SuperSearch = {
 	    ListHtmlObj.on("tap", function(event){
 	        var h = $(this).find("a.bt").attr("s");
 	        var sid = $(this).find("a.bt").attr("sid");
-	        var sds = SuperSearch.s_words.replace(/\+/g,"+");
 			var industry = $(this).find(".industry").text();
-	        SuperSearch.myredirect(h,sid,sds,industry);
+	        SuperSearch.myredirect(h,sid,industry);
 	    });
 	    $('#supersearchPage #list').append(ListHtmlObj);
 //	    var TableHtmlobj=$(html.TableHtml);
 //	    TableHtmlobj.on("tap",function(event){
 //	        var h = $(this).attr("s");
 //	        var sid = $(this).attr("sid");
-//	        var sds = SuperSearch.s_words.replace(/\+/g,"+");
 //			var industry = $(this).attr("i");
-//	        SuperSearch.myredirect(h,sid,sds,industry);
+//	        SuperSearch.myredirect(h,sid,industry);
 //	    });
 //	    $("#supersearchPage #table .content").append(TableHtmlobj);
 		$(".loading_").hide();
@@ -1479,18 +1477,16 @@ var SuperSearch = {
 	   	ListHtmlObj.on("tap", function(event){
 	       var h = $(this).find("a.bt").attr("s");
 	       var sid = $(this).find("a.bt").attr("sid");
-	       var sds = SuperSearch.s_words.replace(/\+/g,"+");
 		   var industry = $(this).find(".industry").text();
-	       SuperSearch.myredirect(h,sid,sds,industry);
+	       SuperSearch.myredirect(h,sid,industry);
 	   	});
 	   	$('#supersearchPage #list').html(ListHtmlObj);
 
 	   	TableHtmlobj.on("tap",function(event){
 	       	var h =  $(this).attr("s");
 	       	var sid = $(this).attr("sid");
-	       	var sds = SuperSearch.s_words.replace(/\+/g,"+");
 			var industry = $(this).attr("i");
-	       	SuperSearch.myredirect(h,sid,sds,industry);
+	       	SuperSearch.myredirect(h,sid,industry);
 	   	});
 	  	if(SuperSearch.subtype_proposed==SuperSearch.reqParam.subtype){
 	       	$("#supersearchPage #table .content").html("<tr><td><div>序号</div></td><td><div style='width: 100px;'>项目代码</div></td><td><div style='width: 207px;'>项目名称</div></td><td><div style='width: 200px;'>审批事项</div></td><td><div style='width: 75px;'>审批结果</div></td><td><div style='width: 75px;'>审批时间</div></td><td><div style='width: 75px;'>发布时间</div></td></tr>");
@@ -1501,10 +1497,14 @@ var SuperSearch = {
 
 		$(".loading_").hide();
 	},
-	myredirect: function (link,sid,sds,industry){  //跳转三级页
+	myredirect: function (link,sid,industry){  //跳转三级页
 		//保存当前页面至sessionStorage
 		SuperSearch.setSessionStorage();
 		if(sid!=undefined){
+			var sds = SuperSearch.s_words;
+			if(SuperSearch.secondFlag=="T"&&SuperSearch.secondKWS!=null&&SuperSearch.secondKWS!=""&&SuperSearch.secondKWS!=undefined){
+				sds = SuperSearch.secondKWS;
+			}
 			//跳转
 			link = link.replace(/\n/g,"");
 			if(link!=""&&!/^http/.test(link)){
@@ -1771,9 +1771,8 @@ var SuperSearch = {
 			ListContent.on("tap", function(event){
 			    var h = $(this).find("a.bt").attr("s");
 			    var sid = $(this).find("a.bt").attr("sid");
-			    var sds = SuperSearch.s_words.replace(/\+/g,"+");
 				var industry = $(this).find(".industry").text();
-			    SuperSearch.myredirect(h,sid,sds,industry);
+			    SuperSearch.myredirect(h,sid,industry);
 			});
 			$("#supersearchPage #list").html(ListContent);
 			SuperSearch.initDropload(SuperSearch.noMoreCache!="true",sessionStorage.superSearch_pageNum);
@@ -1781,9 +1780,8 @@ var SuperSearch = {
 			TableContent.on("tap",function(event){
 			    var h =  $(this).attr("s");
 			    var sid = $(this).attr("sid");
-			    var sds = SuperSearch.s_words.replace(/\+/g,"+");
 				var industry = $(this).attr("i");
-			    SuperSearch.myredirect(h,sid,sds,industry);
+			    SuperSearch.myredirect(h,sid,industry);
 			});
 			$("#supersearchPage #table .data .content").html(TableContent);
 	    }