Browse Source

bug修改

wangfei 6 years ago
parent
commit
23864c7ab7
2 changed files with 23 additions and 3 deletions
  1. 10
    0
      controllers/base.go
  2. 13
    3
      controllers/bodycheck/bodycheck.go

+ 10
- 0
controllers/base.go View File

135
 	}
135
 	}
136
 	return caseIDs
136
 	return caseIDs
137
 }
137
 }
138
+
139
+func (c *BaseController) ResponseOtherEndPoint(msg map[string]interface{}) {
140
+	c.destroyContext(true)
141
+	c.Context.Destroy()
142
+
143
+	c.Data["json"] = msg
144
+
145
+	c.ServeJSON()
146
+	c.StopRun()
147
+}

+ 13
- 3
controllers/bodycheck/bodycheck.go View File

40
 	err := json.Unmarshal(con, &formVal)
40
 	err := json.Unmarshal(con, &formVal)
41
 	if err != nil {
41
 	if err != nil {
42
 		utils.LogError("参数错误:", err)
42
 		utils.LogError("参数错误:", err)
43
-		c.ResponseError(err)
43
+		c.ResponseOtherEndPoint(map[string]interface{}{
44
+			"Status":  false,
45
+			"Message": err.Error(),
46
+		})
44
 	}
47
 	}
45
 
48
 
46
 	err = c.serv.PostCheckResult(formVal)
49
 	err = c.serv.PostCheckResult(formVal)
47
 	if err != nil {
50
 	if err != nil {
48
 		utils.LogError("操作错误:", err)
51
 		utils.LogError("操作错误:", err)
49
-		c.ResponseError(err)
52
+		c.ResponseOtherEndPoint(map[string]interface{}{
53
+			"Status":  false,
54
+			"Message": err.Error(),
55
+		})
50
 	}
56
 	}
51
-	c.ResponseJSON("")
57
+
58
+	c.ResponseOtherEndPoint(map[string]interface{}{
59
+		"Status":  true,
60
+		"Message": "",
61
+	})
52
 }
62
 }