瀏覽代碼

修改xml响应方法

yjp 1 年之前
父節點
當前提交
33cc10b225
共有 1 個文件被更改,包括 11 次插入2 次删除
  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()
 }
 
-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",
+	})
 }