From 3ab2162d2085cc4254563bb91cc1731b76622f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 28 Jun 2023 18:07:04 +0800 Subject: [PATCH] 1 --- platformapi/tao_vegetable/api_model.go | 9 +++++++++ platformapi/tao_vegetable/api_test.go | 13 +++++++++++++ platformapi/tao_vegetable/order_model.go | 6 +++--- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/platformapi/tao_vegetable/api_model.go b/platformapi/tao_vegetable/api_model.go index 8b81434e..fcbab991 100644 --- a/platformapi/tao_vegetable/api_model.go +++ b/platformapi/tao_vegetable/api_model.go @@ -45,3 +45,12 @@ func CallBackResultInfo(err error) *CallBackResult { ErrMsg: err.Error(), } } + +// CallBackResultSign 签名错误 +func CallBackResultSign(err error) *CallBackResult { + return &CallBackResult{ + Success: false, + ErrCode: "sign-check-failure", + ErrMsg: err.Error(), + } +} diff --git a/platformapi/tao_vegetable/api_test.go b/platformapi/tao_vegetable/api_test.go index b556d769..9e814bca 100644 --- a/platformapi/tao_vegetable/api_test.go +++ b/platformapi/tao_vegetable/api_test.go @@ -1,8 +1,10 @@ package tao_vegetable import ( + "fmt" "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/globals" + "strings" "testing" ) @@ -12,3 +14,14 @@ func TestQueryToken(t *testing.T) { globals.SugarLogger.Debugf("data := %s", utils.Format4Output(data, false)) globals.SugarLogger.Debugf("err := %s", utils.Format4Output(err, false)) } + +func TestReplaceString(t *testing.T) { + aa := `{ + "store_id": "CRF003", + "order_status": "PAID", + "merchant_code": "xxx", + "biz_order_id": 123456 +}` + dd := strings.ReplaceAll(strings.ReplaceAll(aa, "\n", ""), " ", "") + fmt.Println(dd) +} diff --git a/platformapi/tao_vegetable/order_model.go b/platformapi/tao_vegetable/order_model.go index a94cbafc..7b6a0b60 100644 --- a/platformapi/tao_vegetable/order_model.go +++ b/platformapi/tao_vegetable/order_model.go @@ -16,11 +16,11 @@ type PublicModel struct { // CallbackOrder 正新订单消息通知 type CallbackOrder struct { - PublicModel - MerchantCode string `json:"merchant_code"` // 商家编码 + //PublicModel StoreId string `json:"store_id"` // 门店id - BizOrderId int64 `json:"biz_order_id"` // 订单号 OrderStatus string `json:"order_status"` // 订单状态 + MerchantCode string `json:"merchant_code"` // 商家编码 + BizOrderId int64 `json:"biz_order_id"` // 订单号 } // OnSaleCancel 售中订单取消回调