From 01423aa626cf19b65630ac34d3a16d6920ced202 Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期二, 02 七月 2019 18:29:33 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.1.14:10010/r/webserver --- controllers/dbtablesCon.go | 4 ++-- controllers/esSearch.go | 2 +- models/dbtables.go | 16 ++++++++-------- controllers/dbtableperson.go | 4 ++-- controllers/taglist.go | 4 ++-- models/model.go | 18 ++++++++---------- 6 files changed, 23 insertions(+), 25 deletions(-) diff --git a/controllers/dbtableperson.go b/controllers/dbtableperson.go index 0ab08be..738128d 100644 --- a/controllers/dbtableperson.go +++ b/controllers/dbtableperson.go @@ -222,8 +222,8 @@ orderType = "asc" } - params := "{\"query\":{\"bool\":{\"filter\":[" + - "{\"term\":{\"isDelete\":\"0\"}}" + syncTerm + "]" + contentParam + "}},\"from\":" + strconv.Itoa(from) + ",\"size\":" + strconv.Itoa(size) + ",\"sort\":{\"" + orderName + "\":{\"order\":\"" + orderType + "\"}}}" + params := "{\"query\":{\"bool\":{\"must_not\":[" + + "{\"term\":{\"isDelete\":\"1\"}}],\"must_not\":[" + syncTerm + "]" + contentParam + "}},\"from\":" + strconv.Itoa(from) + ",\"size\":" + strconv.Itoa(size) + ",\"sort\":{\"" + orderName + "\":{\"order\":\"" + orderType + "\"}}}" fmt.Print("璇锋眰url:%s;\n 璇锋眰鍙傛暟params:%s", url, params) data := esutil.GetEsDataReq(url, params, true) //c.JSON(200, data) diff --git a/controllers/dbtablesCon.go b/controllers/dbtablesCon.go index ee094e3..2eb472c 100644 --- a/controllers/dbtablesCon.go +++ b/controllers/dbtablesCon.go @@ -66,7 +66,7 @@ func (dbt DbTableController) UpdateDbTables(c *gin.Context) { dbtable := new(models.Dbtables) c.BindJSON(&dbtable) - uuid := c.Params.ByName("uuid") + uuid := c.Params.ByName("id") if uuid == "" { uuid = dbtable.Id fmt.Println("body涓幏鍙栧簳搴搃d") @@ -139,7 +139,7 @@ // @Failure 500 {string} json "{"code":500, msg:"杩斿洖閿欒淇℃伅", success:false}" // @Router /data/api-v/dbtable/deleteDBtablesById/{uuid} [POST] func (dbt DbTableController) DeleteDbTables(c *gin.Context) { - uuid := c.Params.ByName("uuid") + uuid := c.Params.ByName("id") url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport + "/" + config.EsInfo.EsIndex.DbTables.IndexName + "/" + config.EsInfo.EsIndex.DbTables.IndexType + "/" + uuid + "/_update" params := "{\"doc\":{\"isDelete\":\"1\"}}" diff --git a/controllers/esSearch.go b/controllers/esSearch.go index 9feb959..5e6a0fd 100644 --- a/controllers/esSearch.go +++ b/controllers/esSearch.go @@ -46,7 +46,7 @@ queryBody := searchBody["inputValue"].(string) //妫�绱㈡ if queryBody != "" { - queryStr = "\"must\":[{\"multi_match\":{\"query\":\"" + queryBody + "\",\"fields\":[\"tableName^1.5\",\"sex^2.0\",\"race^2.0\",\"content^1.0\",\"idCard^1.8\",\"cameraAddr^1.0\"]," + + queryStr = "\"must\":[{\"multi_match\":{\"query\":\"" + queryBody + "\",\"fields\":[\"alarmRules.alarmLevel^1.5\",\"ageDescription^1.5\",\"taskName^1.5\",\"tableName^1.5\",\"sex^2.0\",\"race^2.0\",\"content^1.0\",\"idCard^1.8\",\"cameraAddr^1.0\"]," + "\"type\":\"cross_fields\",\"operator\":\"OR\",\"slop\":0,\"prefix_length\":0,\"max_expansions\":50,\"zero_terms_query\":\"NONE\",\"auto_generate_synonyms_phrase_query\":true,\"fuzzy_transpositions\":true,\"boost\":1}}]," } gteDate := searchBody["searchTime"].([]interface{})[0].(string) diff --git a/controllers/taglist.go b/controllers/taglist.go index d2253a8..7e57a03 100644 --- a/controllers/taglist.go +++ b/controllers/taglist.go @@ -32,9 +32,9 @@ fmt.Println(tokenRes["datalist"].([]interface{})) for _, value := range tokenRes["datalist"].([]interface{}) { tokenRes := make(map[string]interface{}) - tokenRes["key"] = value.(map[string]interface{})["uuid"].(string) + tokenRes["key"] = value.(map[string]interface{})["id"].(string) tokenRes["title"] = value.(map[string]interface{})["tableName"].(string) - tokenRes["value"] = value.(map[string]interface{})["uuid"].(string) + tokenRes["value"] = value.(map[string]interface{})["id"].(string) sources = append(sources, tokenRes) } util.ResponseFormat(c, code.Success, sources) diff --git a/models/dbtables.go b/models/dbtables.go index 3decd6b..869beaa 100644 --- a/models/dbtables.go +++ b/models/dbtables.go @@ -2,14 +2,14 @@ type Dbtables struct { BaseEntity - TableName string `json:"tableName,omitempty" example:"搴曞簱123"` //琛ㄥ悕 - TableDesc string `json:"tableDesc,omitempty" example:"搴曞簱鎻忚堪"` //鎻忚堪 - TableType string `json:"tableType,omitempty" example:"person,car"` //浜哄憳琛�"person - BwType string `json:"bwType,omitempty" example:"榛戝悕鍗�:1,鐧藉悕鍗�:0"` //榛戝悕鍗曪細1锛岀櫧鍚嶅崟锛�0 - StartTime string `json:"startTime,omitempty" example:"2019-01-12 12:14:56"` //鏈夋晥鏈熷紑濮嬫椂闂� - EndTime string `json:"endTime,omitempty" example:"2019-10-12 12:14:56"` //鏈夋晥鏈熺粨鏉熸椂闂� - IsSync string `json:"isSync,omitempty" example:"1:鍚屾搴擄紝2锛氭湰鍦板簱"` //鏄惁鏄悓姝ュ簱(1:鍚屾搴擄紝2锛氭湰鍦板簱) - AnalyServerId string `json:"analyServerId,omitempty" example:"鏈湴搴撴墍灞炵殑鍒嗘瀽璁惧id锛屽鏋滄槸鍚屾搴撳氨涓嶉渶瑕佽褰�"` // 鍒嗘瀽璁惧id(鏈湴搴撴墍灞炵殑鍒嗘瀽璁惧id锛屽鏋滄槸鍚屾搴撳氨涓嶉渶瑕佽褰�) + TableName string `json:"tableName" example:"搴曞簱123"` //琛ㄥ悕 + TableDesc string `json:"tableDesc" example:"搴曞簱鎻忚堪"` //鎻忚堪 + TableType string `json:"tableType" example:"person,car"` //浜哄憳琛�"person + BwType string `json:"bwType" example:"榛戝悕鍗�:1,鐧藉悕鍗�:0"` //榛戝悕鍗曪細1锛岀櫧鍚嶅崟锛�0 + StartTime string `json:"startTime,omitempty" example:"2019-01-12 12:14:56"` //鏈夋晥鏈熷紑濮嬫椂闂� + EndTime string `json:"endTime,omitempty" example:"2019-10-12 12:14:56"` //鏈夋晥鏈熺粨鏉熸椂闂� + IsSync string `json:"isSync" example:"1:鍚屾搴擄紝2锛氭湰鍦板簱"` //鏄惁鏄悓姝ュ簱(1:鍚屾搴擄紝2锛氭湰鍦板簱) + AnalyServerId string `json:"analyServerId" example:"鏈湴搴撴墍灞炵殑鍒嗘瀽璁惧id锛屽鏋滄槸鍚屾搴撳氨涓嶉渶瑕佽褰�"` // 鍒嗘瀽璁惧id(鏈湴搴撴墍灞炵殑鍒嗘瀽璁惧id锛屽鏋滄槸鍚屾搴撳氨涓嶉渶瑕佽褰�) } //UploadFlag string `json:"uploadFlag,omitempty" example:"涓婁紶鏍囧織"` // diff --git a/models/model.go b/models/model.go index d598dee..38534c5 100644 --- a/models/model.go +++ b/models/model.go @@ -2,21 +2,20 @@ import "time" - type BaseEntity struct { - Id string `gorm:"primary_key" json:"id" example:"XeW0HmoBevddG23Ild5o"` + Id string `gorm:"primary_key" json:"id" example:"XeW0HmoBevddG23Ild5o"` CreateTime string `json:"createTime,omitempty" example:""` UpdateTime string `json:"updateTime,omitempty" example:""` - CreateBy string `json:"createBy,omitempty" example:""` - IsDelete bool `json:"isDelete,omitempty" example:"0 鏈垹闄� 1宸插垹闄�"` - Enable bool `json:"enable,omitempty" example:"0 鐢熸晥 1鏈敓鏁�"` + CreateBy string `json:"createBy" example:""` + IsDelete int `json:"isDelete" example:"0 鏈垹闄� 1宸插垹闄�"` + Enable int `json:"enable" example:" 1鐢熸晥 0鏈敓鏁�"` } func (dp *BaseEntity) PriInsert() { dp.CreateTime = time.Now().Format("2006-01-02 15:04:05") dp.CreateBy = "admin" - dp.IsDelete = false - dp.Enable = false + dp.IsDelete = 0 + dp.Enable = 1 } func (dp *BaseEntity) PriUpdate() { @@ -59,7 +58,7 @@ type CameraArea struct { Cameraid string `json:"cameraId"` - Areaid int `json:"areaId"` + Areaid int `json:"areaId"` } type Sdk struct { @@ -72,7 +71,7 @@ //绠楁硶鍙傛暟瀹氫箟 type SdkArg struct { - Alias string `json:"alias"` //鍙傛暟鐨勫埆鍚� + Alias string `json:"alias"` //鍙傛暟鐨勫埆鍚� Name string `json:"name"` //鍙傛暟鍚嶇О Type string `json:"type"` //鍙傛暟绫诲瀷(鏁存暟锛屽瓧绗︿覆鎴栨暟缁�) Must bool `json:"must"` //鏄惁蹇呭~ @@ -137,4 +136,3 @@ X string `json:"x"` Y string `json:"y"` } - -- Gitblit v1.8.0