liuxiaolong
2019-07-24 8ba736b00a482ab531f96b8047c23934e45f2d27
query db person list
1个文件已修改
21 ■■■■■ 已修改文件
controllers/fileController.go 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/fileController.go
@@ -6,6 +6,7 @@
    "basic.com/valib/deliver.git"
    "bytes"
    "encoding/base64"
    "encoding/json"
    "errors"
    "fmt"
    "github.com/gin-gonic/gin"
@@ -27,6 +28,7 @@
    "webserver/extend/util"
    "webserver/models"
    "webserver/service"
    esApi "basic.com/pubsub/esutil.git"
)
type FileController struct {
@@ -168,12 +170,27 @@
            util.ResponseFormat(c, code.ComError, "比对服务请求失败")
            return
        }
        msg, err := reqClient.Recv()
        resultB, err := reqClient.Recv()
        if err !=nil{
            util.ResponseFormat(c, code.ComError, "比对服务响应失败")
            return
        }
        fmt.Println("compareReuslt:",msg)
        m :=make(map[string]float32,0)
        err = json.Unmarshal(resultB, &m)
        if err !=nil{
            util.ResponseFormat(c, code.ComError, "result Unmarshal err")
            return
        }
        personIds := make([]string,len(m))
        for k,_ :=range m{
            personIds = append(personIds,k)
        }
        dbpeople, e := esApi.Dbpersoninfosbyid(personIds, "dbtablepersons", "192.168.1.182", "9200")
        if e !=nil{
            util.ResponseFormat(c, code.ComError, "result es query err")
        } else {
            util.ResponseFormat(c,code.Success,dbpeople)
        }
    }
}