package controllers
|
|
import (
|
"fmt"
|
|
"github.com/gin-gonic/gin"
|
"webserver/extend/code"
|
"webserver/extend/config"
|
"webserver/extend/esutil"
|
"webserver/extend/util"
|
)
|
|
//标签列表
|
//任务列表
|
// @Summary 标签列表
|
// @Description 返回底库标签
|
// @Accept json
|
// @Produce json
|
// @Tags es
|
// @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}"
|
// @Failure 500 {string} json "{"code":500, msg:"返回错误信息", success:false}"
|
// @Router /data/api-v/es/taskList [POST]
|
func (sc *EsSearchController) PostEsTagList(c *gin.Context) {
|
|
url := "http://" + config.EsInfo.Masterip + ":" + config.EsInfo.Httpport +
|
"/" + config.EsInfo.EsIndex.DbTables.IndexName + "/_search"
|
|
prama := "{\"query\":{\"match_all\":{}},\"_source\":[\"tableName\",\"uuid\"]}"
|
|
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{})
|
tokenRes["key"] = value.(map[string]interface{})["id"].(string)
|
tokenRes["title"] = value.(map[string]interface{})["tableName"].(string)
|
tokenRes["value"] = value.(map[string]interface{})["id"].(string)
|
sources = append(sources, tokenRes)
|
}
|
util.ResponseFormat(c, code.Success, sources)
|
}
|