From 4f28408a273a8de52c62b696d1b7e4822278fa12 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期二, 19 十一月 2019 14:59:56 +0800
Subject: [PATCH] delete dbt
---
/dev/null | 176 ----------------------------------------------------------
1 files changed, 0 insertions(+), 176 deletions(-)
diff --git a/service/CameraVideoService.go b/service/CameraVideoService.go
deleted file mode 100644
index 8a158f2..0000000
--- a/service/CameraVideoService.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package service
-
-import (
- "basic.com/valib/logger.git"
- "encoding/json"
- "fmt"
- "strconv"
- "webserver/cache"
- "webserver/extend/config"
- "webserver/extend/esutil"
- "webserver/models"
-)
-
-// 鍦板簱浜哄憳鏁版嵁 涓� 姣斿鍋氬噯澶�
-func QueryDbPersonsForCompare(reqBody models.EsSearch) map[string]interface{} {
- localConf, err2 := cache.GetServerInfo()
- if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" {
- logger.Debug("localConfig is wrong!!!")
- return nil
- }
- url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) +
- "/" + config.EsInfo.EsIndex.Dbtablepersons.IndexName + "/_search"
- tableIds := make([]string, 20)
- if reqBody.DataBases != nil {
- tableIds = reqBody.DataBases
- }
- startDate := ""
- endDate := ""
- if reqBody.SearchTime != nil && len(reqBody.SearchTime) >= 2 {
- dates := reqBody.SearchTime
- startDate = dates[0]
- endDate = dates[1] // 璧峰缁撴潫鏃堕棿
- }
- contentValue := reqBody.InputValue //杈撳叆妗嗗唴瀹�
- /*page := 1 ;if reqBody["page"] != nil { page = int(reqBody["page"].(float64)) } // 椤电爜
- size := 8 ;if reqBody["size"] != nil { size = int(reqBody["size"].(float64)) }// 鏉℃暟
- from := (page - 1) * size
- */
- syncTerm := ""
- contentParam := ""
- if len(tableIds) < 1 {
- // / 鎵�鏈変汉鍛�
- } else {
- bytes, _ := json.Marshal(tableIds)
- syncTerm += ",{\"terms\":{\"tableId\":" + string(bytes) + "}}" // 搴曞簱浜哄憳
- }
- if startDate != "" && endDate != "" {
- syncTerm += ",{\"range\":{\"createTime\":{\"from\":\"" + startDate + "\"," +
- "\"to\":\"" + endDate + "\",\"include_lower\":true,\"include_upper\":true,\"boost\":1}}}" // 搴曞簱浜哄憳
- }
- if contentValue != "" {
- contentParam = ",\"must\":[{\"multi_match\":{\"query\":\"" + contentValue + "\",\"type\":\"best_fields\"," +
- "\"fields\":[\"personName\",\"sex\",\"idcard\",\"phoneNum\",\"reserved\"],\"boost\":1}}]"
- }
- params := "{\"query\":{\"bool\":{\"filter\":[" +
- "{\"term\":{\"isDelete\":\"0\"}}" + syncTerm + "]" + contentParam + "}},\"from\":0,\"size\":10000,\"sort\":{\"uuid\":{\"order\":\"desc\"}}}"
- fmt.Print("鏌ヨ鍏ㄩ儴搴曞簱浜哄憳 璇锋眰url:%s;\n 璇锋眰鍙傛暟params:%s", url, params)
- data := esutil.GetEsDataReq(url, params, true)
- return data
-}
diff --git a/service/EnableStatusControlService.go b/service/EnableStatusControlService.go
deleted file mode 100644
index a0439b1..0000000
--- a/service/EnableStatusControlService.go
+++ /dev/null
@@ -1,176 +0,0 @@
-package service
-
-import (
- "basic.com/valib/logger.git"
- "encoding/json"
- "fmt"
- "strconv"
- "strings"
- "time"
- "webserver/cache"
- "webserver/extend/config"
- "webserver/extend/esutil"
-)
-
-func GetVerificationData() []map[string]interface{} {
- localConf, err2 := cache.GetServerInfo()
- if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" {
- logger.Debug("localConfig is wrong!!!")
- return nil
- }
- url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) +
- "/" + config.EsInfo.EsIndex.DbTables.IndexName + "/_search"
-
- jsonDSL := `{
- "query": {
- "bool": {
- "filter": [{
- "term": {
- "isDelete": "0"
- }
- },
- {
- "terms": {
- "analyServerId": ["` + localConf.ServerId + `",""]
- }
- }
- ]
- }
- },
- "size": 10000
-}
-`
- buf, err := esutil.EsReq("POST", url, []byte(jsonDSL))
- if err != nil {
- logger.Debug(err)
- }
-
- sources, err := esutil.Sourcelist(buf)
- if err != nil {
- logger.Debug(err)
- }
- return sources
-}
-
-func VerificationTime(source []map[string]interface{}) map[string][]string {
- resultInfo := make(map[string][]string, 0)
- currentTime := time.Now()
- for _, v := range source {
- id := v["id"].(string)
- startTime := v["startTime"].(string)
- endTime := ""
- if v["endTime"] != nil {
- endTime = v["endTime"].(string)
- }
- st, _ := time.ParseInLocation("2006-01-02 15:04:05", startTime, time.Local)
- if endTime != "" {
- et, _ := time.ParseInLocation("2006-01-02 15:04:05", endTime, time.Local)
- if et.After(currentTime) && st.Before(currentTime) {
- resultInfo["effective"] = append(resultInfo["effective"], id)
- } else {
- resultInfo["invalid"] = append(resultInfo["invalid"], id)
- }
- } else if st.Before(currentTime) && endTime == "" {
- resultInfo["effective"] = append(resultInfo["effective"], id)
- } else {
- resultInfo["invalid"] = append(resultInfo["invalid"], id)
- }
- }
- //fmt.Println(resultInfo)
- return resultInfo
-}
-
-func UpdateEnableStatus(id []string, flag bool) (message string) {
- ids := strings.Replace(strings.Trim(fmt.Sprint(id), "[]"), " ", "\",\"", -1)
- status := 0
- if flag == true {
- status = 1
- }
- enable := strconv.Itoa(status)
- localConf, err2 := cache.GetServerInfo()
- if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" {
- logger.Debug("localConfig is wrong!!!")
- return "localConf wrong"
- }
- url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) +
- "/" + config.EsInfo.EsIndex.DbTables.IndexName + "/_update_by_query?refresh"
- jsonDsl := `
- {
- "script": {
- "lang": "painless",
- "inline": "ctx._source.enable = ` + enable + `"
- },
- "query": {
- "terms": {
- "id": ["` + ids + `"]
- }
- }
-}
-`
- buf, err := esutil.EsReq("POST", url, []byte(jsonDsl))
- if err != nil {
- logger.Debug("http request info is err!")
- message = "淇敼澶辫触"
- }
- var info interface{}
- json.Unmarshal(buf, &info)
- out, ok := info.(map[string]interface{})
- if !ok {
- logger.Debug("http response interface can not change map[string]interface{}")
- message = "淇敼澶辫触"
- }
- middle, ok := out["updated"].(float64)
- if !ok {
- logger.Debug("first result change error!")
- message = "淇敼澶辫触"
- }
- if middle > 0 {
- logger.Debug("淇敼鎴愬姛")
- //if flag {//鐢熸晥鐨�
- // discovery.AddDbMessage(&protomsg.EsPersonCacheChange{
- // Type: protomsg.EsCacheChanged_T_DbTable,
- // PersonId: "",
- // TableId: id,
- // Feature: "",
- // Action: protomsg.DbAction_Insert,
- // })
- //} else {//澶辨晥鐨�
- // discovery.AddDbMessage(&protomsg.EsPersonCacheChange{
- // Type: protomsg.EsCacheChanged_T_DbTable,
- // PersonId: "",
- // TableId: id,
- // Feature: "",
- // Action: protomsg.DbAction_Insert,
- // })
- //}
- message = "淇敼鎴愬姛"
- }
- return message
-}
-
-func InitEnableStatus() (messageInfo string) {
- verificationData := GetVerificationData()
- verificationTime := VerificationTime(verificationData)
- idOfEffective := verificationTime["effective"]
- idOfinvalid := verificationTime["invalid"]
- mesInfo := false
- effectiveMesInfo := ""
- invalidMesInfo := ""
- if len(idOfEffective) > 0 {
- effectiveMesInfo = UpdateEnableStatus(idOfEffective, true)
- } else {
- effectiveMesInfo = "淇敼鎴愬姛"
- }
- if len(idOfinvalid) > 0 {
- invalidMesInfo = UpdateEnableStatus(idOfinvalid, false)
- } else {
- invalidMesInfo = "淇敼鎴愬姛"
- }
- if effectiveMesInfo == "淇敼鎴愬姛" && invalidMesInfo == "淇敼鎴愬姛" {
- mesInfo = true
- }
- if mesInfo == true {
- messageInfo = "淇敼鎴愬姛"
- }
- return messageInfo
-}
--
Gitblit v1.8.0