| | |
| | | paramBody := util.Struct2Map(dbperson) |
| | | b, data := pApi.AddDbPerson(paramBody) |
| | | if b { |
| | | util.ResponseFormat(c, code.Success, data) |
| | | util.ResponseFormat(c, code.AddSuccess, data) |
| | | } else { |
| | | util.ResponseFormat(c, code.ServiceInsideError, "") |
| | | util.ResponseFormat(c, code.ComError, "") |
| | | } |
| | | } |
| | | |
| | | |
| | | type MultiCarNo struct { |
| | | TableId string `json:"tableId" binding:"required"` |
| | | CarNos []string `json:"carNos" binding:"required"` |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 批量添加底库车辆 |
| | | // @Description 批量添加底库车辆 |
| | | // @Accept json |
| | | // @Produce json |
| | | // @Tags dbperson 底库人员 |
| | | // @Param reqBody body controllers.MultiCarNo true "批量车牌号" |
| | | // @Success 200 {string} json "{"code":200, msg:"", success:true}" |
| | | // @Failure 500 {string} json "{"code":500, msg:"", success:false}" |
| | | // @Router /data/api-v/dbperson/multiUploadCarNo [post] |
| | | func (dbc DbPersonController) MultiUploadCarNo(c *gin.Context) { |
| | | var reqBody MultiCarNo |
| | | err := c.BindJSON(&reqBody) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "") |
| | | return |
| | | } |
| | | logger.Debug("multiUploadCarNo reqBody:", reqBody) |
| | | var pApi dbapi.DbPersonApi |
| | | paramBody := util.Struct2Map(reqBody) |
| | | if pApi.MultiUploadCarNo(paramBody) { |
| | | util.ResponseFormat(c,code.UploadSuccess,"上传成功") |
| | | } else { |
| | | util.ResponseFormat(c,code.ComError,"") |
| | | } |
| | | } |
| | | |
| | |
| | | paramBody := util.Struct2Map(dbperson) |
| | | b, data := pApi.UpdateDbPerson(paramBody) |
| | | if b { |
| | | util.ResponseFormat(c, code.Success, data) |
| | | util.ResponseFormat(c, code.UpdateSuccess, data) |
| | | } else { |
| | | util.ResponseFormat(c, code.ServiceInsideError, "") |
| | | util.ResponseFormat(c, code.UpdateFail, "") |
| | | } |
| | | } |
| | | |
| | |
| | | logger.Debug("localConfig is wrong!!!") |
| | | return |
| | | } |
| | | var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit" |
| | | var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit?collection=persistent" |
| | | //根据人脸坐标扣出人脸小图 |
| | | t1 := time.Now() |
| | | cutFaceImgData := util.SubImg(*pI, int(rcFace.Left), int(rcFace.Top), int(rcFace.Right), int(rcFace.Bottom)) |
| | |
| | | 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 |
| | | //将这张抓拍的照片下载下来上传到collection=persistent的集合中,防止被清理掉 |
| | | picB, e3 := util.DownLoad("http://" + personPicUrl) |
| | | if e3 == nil { |
| | | var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit?collection=persistent" |
| | | newPersonPicUrl, e4 := WeedFSClient.UploadFile(weedfsUri, "capturePerson", picB) |
| | | if e4 == nil { |
| | | var dbpApi dbapi.DbPersonApi |
| | | b,d := dbpApi.JoinDbTable(reqBody.TableIds, feature, newPersonPicUrl) |
| | | if b { |
| | | util.ResponseFormat(c,code.Success,d) |
| | | return |
| | | } else { |
| | | util.ResponseFormat(c,code.ComError,"加入失败") |
| | | return |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | util.ResponseFormat(c,code.ComError,"加入失败") |