From d28856771a456f1862fb64e9fe16ac5a05dd4c94 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期四, 25 七月 2019 15:34:04 +0800
Subject: [PATCH] fix map nil

---
 controllers/fileController.go |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/controllers/fileController.go b/controllers/fileController.go
index 29839f6..c793363 100644
--- a/controllers/fileController.go
+++ b/controllers/fileController.go
@@ -181,9 +181,9 @@
 
 var captureTable = "capturetable" // 鎶撴媿搴�
 type SearchCondition struct {
-	Url string `json:"url"`
-	TableIds []string `json:"tableIds"`
-	CompThreshold string `json:"compThreshold"`
+	PicUrl string `json:"picUrl"`
+	Databases []string `json:"databases"`
+	Threshold string `json:"threshold"`
 }
 // @Summary 浠ュ浘鎼滃浘
 // @Description  浠ュ浘鎼滃浘
@@ -197,16 +197,16 @@
 func (controller FileController) SearchByPhoto(c *gin.Context) {
 	var condition SearchCondition
 	err := c.BindJSON(&condition)
-	if err !=nil || condition.Url == "" {
+	if err !=nil || condition.PicUrl == "" {
 		util.ResponseFormat(c, code.RequestParamError, "鍙傛暟鏈夎")
 		return
 	}
-	compThreshold, err := strconv.ParseFloat(condition.CompThreshold,32)
-	if condition.Url == "" || err != nil {
+	compThreshold, err := strconv.ParseFloat(condition.Threshold,32)
+	if condition.PicUrl == "" || err != nil {
 		util.ResponseFormat(c, code.RequestParamError, "鍙傛暟鏈夎")
 		return
 	}
-	if face,ok := faceExtractedMap[condition.Url];!ok{
+	if face,ok := faceExtractedMap[condition.PicUrl];!ok{
 		util.ResponseFormat(c, code.RequestParamError, "鍙傛暟鏈夎")
 		return
 	} else {
@@ -215,8 +215,8 @@
 			FaceFeature:face.FaceBytes,
 			CompareThreshold:float32(compThreshold),
 		}
-		if condition.TableIds !=nil {
-			arg.TableIds = append(arg.TableIds, condition.TableIds...)
+		if condition.Databases !=nil {
+			arg.TableIds = append(arg.TableIds, condition.Databases...)
 		}
 		b, err := proto.Marshal(&arg)
 		if err !=nil{
@@ -243,8 +243,8 @@
 				continue
 			}
 
-			var dbPersonM map[string]*protomsg.Esinfo
-			var captureM map[string]*protomsg.Esinfo
+			dbPersonM := make(map[string]*protomsg.Esinfo,0)
+			captureM := make(map[string]*protomsg.Esinfo,0)
 			var personIds []string
 			var captureIds []string
 			for _,v :=range rList{

--
Gitblit v1.8.0