Browse Source

修改xml响应方法

yjp 1 year ago
parent
commit
33cc10b225
1 changed files with 11 additions and 2 deletions
  1. 11 2
      http_binding/response/response.go

+ 11 - 2
http_binding/response/response.go

@@ -166,6 +166,15 @@ func WriteBytes(c *binding_context.Context, statusCode int, bytes []byte, err er
 	c.Writer.Flush()
 	c.Writer.Flush()
 }
 }
 
 
-func SendMapXMLResponseIgnoreError(c *binding_context.Context, statusCode int, data map[string]any, _ error) {
-	c.XML(statusCode, data)
+func SendWXOrderResponse(c *binding_context.Context, statusCode int, _ any, err error) {
+	if err == nil {
+		c.XML(statusCode, map[string]any{
+			"return_code": "FAIL",
+			"return_msg":  err.Error(),
+		})
+	}
+
+	c.XML(statusCode, map[string]any{
+		"return_code": "SUCCESS",
+	})
 }
 }