| | |
| | | package controllers |
| | | |
| | | import ( |
| | | "basic.com/dbapi.git" |
| | | "encoding/json" |
| | | "fmt" |
| | | |
| | |
| | | |
| | | url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport + |
| | | "/" + config.EsInfo.EsIndex.DbTables.IndexName + "/_search" |
| | | |
| | | prama := "{\"query\":{\"bool\":{\"filter\":[]}},\"size\":10000,\"_source\":[\"tableName\",\"id\",\"isDelete\"]}" |
| | | |
| | | var setApi dbapi.SysSetApi |
| | | _, sysconf := setApi.GetServerInfo() |
| | | prama := "{\"query\":{\"bool\":{\"filter\":[{\"terms\":{\"analyServerId\":[\"\",\"" + sysconf.ServerId + "\"]}}]}},\"size\":1000}" |
| | | tokenRes := esutil.GetEsDataReq(url, prama, true) |
| | | sources := make([]map[string]interface{}, 0) |
| | | fmt.Println(tokenRes["datalist"].([]interface{})) |
| | | for _, value := range tokenRes["datalist"].([]interface{}) { |
| | | tokenRes := make(map[string]interface{}) |
| | | key := value.(map[string]interface{})["id"].(string) |
| | |
| | | if GetTotalFromDb(key) == false{ |
| | | continue |
| | | } |
| | | |
| | | } |
| | | sources = append(sources, tokenRes) |
| | | } |
| | | util.ResponseFormat(c, code.Success, sources) |
| | | } |
| | | |
| | | //判断底库是否有数据 |
| | | func GetTotalFromDb(id string) (flag bool) { |
| | | flag = false |
| | |
| | | return |
| | | } |
| | | total := int(middle["total"].(float64)) |
| | | fmt.Println(total) |
| | | if total > 0 { |
| | | flag=true |
| | | } |