| | |
| | | "fmt" |
| | | "github.com/gin-gonic/gin" |
| | | "github.com/satori/go.uuid" |
| | | "strconv" |
| | | "time" |
| | | "webserver/cache" |
| | | "webserver/extend/code" |
| | | "webserver/extend/config" |
| | | "webserver/extend/esutil" |
| | |
| | | |
| | | // 依据底库id 查询数据 |
| | | func QueryDbTableInfo(tableId string) map[string]interface{} { |
| | | url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport + |
| | | 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 + "/" + config.EsInfo.EsIndex.DbTables.IndexName + "/" + tableId |
| | | logger.Debug("请求url:%s;", url) |
| | | data := esutil.GetEsDataInfo(url, true) |
| | |
| | | |
| | | func UpdateEndTime(id string) (flag bool) { |
| | | flag = false |
| | | url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport + |
| | | localConf, err2 := cache.GetServerInfo() |
| | | if err2 !=nil || localConf.AlarmIp == "" || localConf.ServerId == "" { |
| | | logger.Debug("localConfig is wrong!!!") |
| | | return false |
| | | } |
| | | url := "http://" + localConf.AlarmIp + ":" + strconv.Itoa(int(localConf.AlarmPort)) + |
| | | "/" + config.EsInfo.EsIndex.DbTables.IndexName + "/" + config.EsInfo.EsIndex.DbTables.IndexType + "/" + id + "/_update?refresh=wait_for" |
| | | prama := "{\"script\":\"ctx._source.remove(\\\"endTime\\\")\"}" |
| | | buf, err := esutil.EsReq("POST", url, []byte(prama)) |