Просмотр исходного кода

修改通过名片查询的情况没有办法查到

李广朋 9 лет назад
Родитель
Сommit
2ff0ac8680
1 измененных файлов с 10 добавлено и 2 удалено
  1. 10 2
      core/src/qfw/search/wxsearchservice.go

+ 10 - 2
core/src/qfw/search/wxsearchservice.go

@@ -7,6 +7,7 @@ import (
 	"github.com/go-xweb/xweb"
 	"github.com/p/mahonia"
 	"html/template"
+	"log"
 	"qfw/coreutil"
 	"qfw/mobile"
 	. "qfw/util"
@@ -17,6 +18,7 @@ import (
 	"qfw/util/redis"
 	"strconv"
 	"strings"
+	"time"
 )
 
 //企业社区首页
@@ -77,13 +79,18 @@ func FormatData(data *[]map[string]interface{}) string {
 		return ""
 	}
 	for _, v := range *data {
+		estDate := fmt.Sprint(v["EstDate"])
+		if strings.Index(estDate, "-") == -1 {
+			unix, _ := strconv.Atoi(estDate)
+			estDate = time.Unix(int64(unix), 0).Format("2006-01-02")
+		}
 		tmp := map[string]string{
 			"_id":           fmt.Sprint(v["_id"]),
 			"EntName":       fmt.Sprint(v["EntName"]),
 			"RegNo":         fmt.Sprint(v["RegNo"]),
 			"LeRep":         fmt.Sprint(v["LeRep"]),
 			"OpLocDistrict": fmt.Sprint(v["OpLocDistrictName"]),
-			"EstDate":       fmt.Sprint(v["EstDate"]),
+			"EstDate":       estDate,
 			"OpStateName":   fmt.Sprint(v["OpStateName"]),
 		}
 		entinfos = append(entinfos, tmp)
@@ -407,7 +414,7 @@ func wxsearhWebContententMp(querymap map[string]string, n *Wxsearch, reqType str
 	var query = `{
 	    "query": {
 	        "bool": {
-	            "must": ["match": {"enterprise.EntName": {"query": "` + keyword + `","operator": "and"}}}],
+	            "must": [{"match": {"enterprise.EntName": {"query": "` + keyword + `","operator": "and"}}}],
 	            "must_not": {"terms": {"SourceType": ["03", "04"]}},
 	            "should": [],
 	            "minimum_should_match": 1
@@ -434,6 +441,7 @@ func wxsearhWebContententMp(querymap map[string]string, n *Wxsearch, reqType str
 	    "from": 0,"size": 10,
 	    "sort": [{"OpSint": "desc","RegCap": "desc"}]
 	}`
+	log.Println(query)
 	//查询列表数据
 	client := elastic.GetEsConn()
 	defer elastic.DestoryEsConn(client)