| | |
| | | util.ResponseFormat(c, code.RequestParamError, "参数有误") |
| | | return |
| | | } |
| | | databases := searchBody.DataBases |
| | | from := 0 |
| | | to := 0 |
| | | |
| | | data := make(map[string]interface{}) |
| | | searchBody.Page = 1 |
| | | searchBody.Size = 15000 |
| | | |
| | | if len(databases) == 1 && databases[0] == "esData" { |
| | | searchBody.IsAggs = false |
| | | if searchBody.CompareNum !="" { |
| | | //二次搜索,不需要再比对了 |
| | | co := service.GetCompResultByNum(searchBody.CompareNum) |
| | | if co != nil { |
| | | //二次搜索和排序 |
| | | twiceM := GetCompareDataTwice(co,searchBody) |
| | | util.ResponseFormat(c,code.Success,twiceM) |
| | | } else { |
| | | data = service.QueryDbPersonsForCompare(*searchBody) |
| | | m :=make(map[string]interface{},0) |
| | | m["compareNum"] = searchBody.CompareNum |
| | | m["total"] = 0 |
| | | m["totalList"] = []service.CompareResult{} |
| | | util.ResponseFormat(c,code.CompareResultGone,m) |
| | | } |
| | | sources := data["datalist"].([]interface{}) |
| | | |
| | | if len(sources) > 0 { |
| | | //进行比对 |
| | | } else { |
| | | fmt.Println("查询条件下无数据 source 数据为空:" + string(len(sources))) |
| | | } |
| | | dataLen := len(sources) |
| | | if from > dataLen-1 { |
| | | from = 0 |
| | | to = 0 |
| | | } |
| | | if to > dataLen { |
| | | to = dataLen |
| | | } |
| | | |
| | | dmap := make(map[string]interface{}, 2) |
| | | dmap["datalist"] = sources |
| | | dmap["total"] = dataLen |
| | | util.ResponseFormat(c, code.Success, dmap) |
| | | |
| | | m :=make(map[string]interface{},0) |
| | | m["compareNum"] = searchBody.CompareNum |
| | | m["total"] = 0 |
| | | m["totalList"] = []service.CompareResult{} |
| | | util.ResponseFormat(c,code.CompareResultGone,m) |
| | | } |
| | | |
| | | func searchEsData(searchBody models.EsSearch) map[string]interface{} { |