From 2bd2068c999cda5bda8c0787ed0dcaac6cb7afdb Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@iotlink.com> Date: 星期四, 31 十月 2019 13:27:46 +0800 Subject: [PATCH] feat: add system reboot api --- controllers/dbtableperson.go | 66 ++++++++++++++++++++++++++++++++- 1 files changed, 64 insertions(+), 2 deletions(-) diff --git a/controllers/dbtableperson.go b/controllers/dbtableperson.go index c96ed64..902e998 100644 --- a/controllers/dbtableperson.go +++ b/controllers/dbtableperson.go @@ -21,11 +21,14 @@ "webserver/extend/esutil" "webserver/extend/util" "webserver/models" + + esApi "basic.com/pubsub/esutil.git" ) type DbPersonController struct { } +// @Security ApiKeyAuth // @Summary 娣诲姞搴曞簱浜哄憳 // @Description 娣诲姞搴曞簱浜哄憳 // @Accept json @@ -79,6 +82,7 @@ return result } +// @Security ApiKeyAuth // @Summary 淇敼搴曞簱浜哄憳 // @Description 淇敼搴曞簱浜哄憳 // @Accept json @@ -106,6 +110,7 @@ } } +// @Security ApiKeyAuth // @Summary 搴曞簱浜哄憳浠ュ浘鎼滃浘 // @Description 搴曞簱浜哄憳浠ュ浘鎼滃浘 // @Accept json @@ -141,7 +146,7 @@ arg := protomsg.CompareArgs{ FaceFeature: faceB, - CompareThreshold: 0.6, + CompareThreshold: searchBody.Threshold, } arg.TableIds = searchBody.DataBases arg.AnalyServerId = analyServerId @@ -238,11 +243,12 @@ return resultList } +// @Security ApiKeyAuth // @Summary 鏇存柊搴曞簱浜鸿劯鐓х墖 // @Description 鏇存柊搴曞簱浜鸿劯鐓х墖 // @Accept json // @Produce json -// @Tags 搴曞簱浜哄憳 +// @Tags dbperson 搴曞簱浜哄憳 // @Param id formData string true "浜哄憳id" // @Param file formData file true "浜鸿劯鍥剧墖" // @Success 200 {string} json "{"code":200, msg:"", success:true}" @@ -364,6 +370,7 @@ return message } +// @Security ApiKeyAuth // @Summary 鍒犻櫎搴曞簱浜哄憳 // @Description 鍒犻櫎搴撲汉鍛� // @Accept x-www-form-urlencoded @@ -391,6 +398,7 @@ type DelMultiPerson []string +// @Security ApiKeyAuth // @Summary 鍒犻櫎搴曞簱浜哄憳 // @Description 鍒犻櫎搴撲汉鍛� // @Accept json @@ -420,6 +428,7 @@ } } +// @Security ApiKeyAuth // @Summary 鏌ヨ搴曞簱浜哄憳鍒楄〃 // @Description 鏌ヨ搴撲汉鍛樺垪琛� // @Accept json @@ -484,6 +493,59 @@ } } +type JoinDbTVo struct { + CaptureId string `json:"captureId"` + TableIds []string `json:"tableIds"` +} + +// @Security ApiKeyAuth +// @Summary 鎶撴媿浜哄憳鍔犲叆搴曞簱 +// @Description 鎶撴媿浜哄憳鍔犲叆搴曞簱 +// @Accept json +// @Produce json +// @Tags dbperson 搴曞簱浜哄憳 +// @Param obj body controllers.JoinDbTVo true "搴曞簱鏁版嵁" +// @Success 200 {string} json "{"code":200, msg:"鐩綍缁撴瀯鏁版嵁", success:true}" +// @Failure 500 {string} json "{"code":500, msg:"杩斿洖閿欒淇℃伅", success:false}" +// @Router /data/api-v/dbperson/joinDbTable [POST] +func (sc *DbPersonController) JoinDbTable(c *gin.Context) { + var reqBody JoinDbTVo + c.BindJSON(&reqBody) + if reqBody.CaptureId == "" || len(reqBody.TableIds) ==0 { + util.ResponseFormat(c,code.RequestParamError, "鍙傛暟鏈夎") + return + } + localConf, err := cache.GetServerInfo() + if err !=nil || localConf.AlarmIp == "" || localConf.AlarmPort <=0 { + util.ResponseFormat(c,code.ComError,"鎶ヨ璁剧疆鏈夎") + return + } + videopersons, e := esApi.Videopersonsinfosbyid([]string{reqBody.CaptureId}, config.EsInfo.EsIndex.VideoPersons.IndexName, localConf.AlarmIp, strconv.Itoa(int(localConf.AlarmPort))) + if e ==nil && videopersons !=nil && len(videopersons) == 1{ + var personPicUrl = ""//浜鸿劯鍥剧墖 + var feature = ""//鐗瑰緛 + if videopersons[0].PicSmUrl !=nil && len(videopersons[0].PicSmUrl) >0 { + personPicUrl = videopersons[0].PicSmUrl[0] + } + fea, e2 := esApi.GetVideoPersonFaceFeatureById(reqBody.CaptureId, config.EsInfo.EsIndex.VideoPersons.IndexName, localConf.AlarmIp, strconv.Itoa(int(localConf.AlarmPort))) + if e2 == nil && fea !="" { + feature = fea + } + if personPicUrl != "" && feature != "" { + var dbpApi dbapi.DbPersonApi + b,d := dbpApi.JoinDbTable(reqBody.TableIds, feature, personPicUrl) + if b { + util.ResponseFormat(c,code.Success,d) + return + } else { + util.ResponseFormat(c,code.ComError,"鍔犲叆澶辫触") + return + } + } + } + util.ResponseFormat(c,code.ComError,"鍔犲叆澶辫触") +} + type DbtSearch struct { TableId string `json:"tableId"` OrderName string `json:"orderName"` -- Gitblit v1.8.0