From 6dea379dc74a941a83c2e5582963c0e58e6ca5bf Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期五, 23 八月 2024 18:32:10 +0800 Subject: [PATCH] 修改楼层解析, 添加老版本兼容 --- client/faces.go | 33 +++++++++++++++++++++++++++++++-- 1 files changed, 31 insertions(+), 2 deletions(-) diff --git a/client/faces.go b/client/faces.go index 6c25b7c..42e3827 100644 --- a/client/faces.go +++ b/client/faces.go @@ -1,14 +1,18 @@ package client import ( + "fmt" + "encoding/json" + "gat1400Exchange/config" "gat1400Exchange/pkg/logger" "gat1400Exchange/util" "gat1400Exchange/vo" ) const ( - FacesUrI = "/VIID/Faces" + FacesUrI = "/VIID/Faces" + PersonsUrI = "/VIID/Persons" ) func FaceCapture(msg []byte) int { @@ -16,7 +20,8 @@ return clientStatus } - rsp, err := util.HttpPost(FacesUrI, headers, msg) + url := fmt.Sprintf("%s://%s:%s%s", config.ClientConf.Proto, config.ClientConf.ServerAddr, config.ClientConf.ServerPort, FacesUrI) + rsp, err := util.HttpPost(url, headers, msg) if err != nil { logger.Warn("Post faces failed, %s", err.Error()) return vo.StatusOtherError @@ -32,3 +37,27 @@ logger.Debug("Post faces success.") return stat.StatusCode } + +func PersonCapture(msg []byte) int { + if clientStatus != vo.StatusSuccess { + return clientStatus + } + + url := fmt.Sprintf("%s://%s:%s%s", config.ClientConf.Proto, config.ClientConf.ServerAddr, config.ClientConf.ServerPort, PersonsUrI) + rsp, err := util.HttpPost(url, headers, msg) + if err != nil { + logger.Warn("Post person failed, %s", err.Error()) + return vo.StatusOtherError + } + + var stat vo.ResponseStatus + err = json.Unmarshal(rsp, &stat) + if err != nil { + logger.Warn("Post person response unmarshal failed, %s", err.Error()) + return vo.StatusOtherError + } + + logger.Debug("Post person success.") + + return stat.StatusCode +} -- Gitblit v1.8.0