From b3c3c09d567b60eb63789061406cfa7ebc96afa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 29 Jun 2023 09:18:02 +0800 Subject: [PATCH] 1 --- platformapi/tao_vegetable/api_model.go | 4 ++-- platformapi/tao_vegetable/order_afs.go | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/platformapi/tao_vegetable/api_model.go b/platformapi/tao_vegetable/api_model.go index 55475e59..76e51bdf 100644 --- a/platformapi/tao_vegetable/api_model.go +++ b/platformapi/tao_vegetable/api_model.go @@ -52,13 +52,13 @@ func CallBackResultSign(err error) *CallBackResult { return &CallBackResult{ Success: true, ErrCode: "SUCCESS", - ErrMsg: err.Error(), + ErrMsg: "", } } return &CallBackResult{ Success: false, ErrCode: "sign-check-failure", - ErrMsg: "", + ErrMsg: err.Error(), } } diff --git a/platformapi/tao_vegetable/order_afs.go b/platformapi/tao_vegetable/order_afs.go index 2cf1d047..3e3f9832 100644 --- a/platformapi/tao_vegetable/order_afs.go +++ b/platformapi/tao_vegetable/order_afs.go @@ -95,6 +95,10 @@ func (a *API) UserApplyRefund(c *http.Request) (*UserApplyRefundCallBack, error) if err != nil { return nil, err } + + if len(data) == 0 { + return nil, err + } var result *UserApplyRefundCallBack if err := json.Unmarshal(data, result); err != nil { return nil, err @@ -108,6 +112,10 @@ func (a *API) UserCancelRefundApply(c *http.Request) (*UserCancelRefundApply, er if err != nil { return nil, err } + + if len(data) == 0 { + return nil, err + } var result *UserCancelRefundApply if err := json.Unmarshal(data, result); err != nil { return nil, err @@ -119,6 +127,9 @@ func (a *API) UserCancelRefundApply(c *http.Request) (*UserCancelRefundApply, er func (a *API) OnSaleRefundOrder(c *http.Request) (*OnSaleCancel, error) { body, _ := ioutil.ReadAll(c.Body) + if len(body) == 0 { + return nil, nil + } var onSaleOrder *OnSaleCancel if err := json.Unmarshal(body, &onSaleOrder); err != nil { return nil, err @@ -132,6 +143,10 @@ func (a *API) RefundOrderFinish(c *http.Request) (*RefundOrderFinish, error) { if err != nil { return nil, err } + + if len(data) == 0 { + return nil, nil + } var result *RefundOrderFinish if err := json.Unmarshal(data, result); err != nil { return nil, err