From f8c58e95be781b052d37f9a2e552c4ff39378da4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 25 Oct 2022 17:22:00 +0800 Subject: [PATCH 1/3] 1 --- platformapi/jdapi/jdapi.go | 4 ++++ platformapi/tiktok_shop/tiktok_api/sku_test.go | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/platformapi/jdapi/jdapi.go b/platformapi/jdapi/jdapi.go index b0ffa7d4..bec81824 100644 --- a/platformapi/jdapi/jdapi.go +++ b/platformapi/jdapi/jdapi.go @@ -4,6 +4,7 @@ import ( "bytes" "crypto/md5" "encoding/json" + "errors" "fmt" "net/http" "reflect" @@ -280,6 +281,9 @@ func (a *API) AccessAPINoPage2(apiStr string, jdParams map[string]interface{}, k if err != nil { return nil, err } + if jsonResult["code"].(string) != "0" { + return nil, errors.New(jsonResult["msg"].(string)) + } var data map[string]interface{} if err := utils.UnmarshalUseNumber([]byte(jsonResult["data"].(string)), &data); err != nil { return nil, platformapi.ErrResponseDataFormatWrong diff --git a/platformapi/tiktok_shop/tiktok_api/sku_test.go b/platformapi/tiktok_shop/tiktok_api/sku_test.go index 1273afd3..46c0a80f 100644 --- a/platformapi/tiktok_shop/tiktok_api/sku_test.go +++ b/platformapi/tiktok_shop/tiktok_api/sku_test.go @@ -36,8 +36,9 @@ func TestCategory(t *testing.T) { } func TestGetCatePropertyV2(t *testing.T) { - data, err := a.GetCatePropertyV2(29146) + data, err := a.GetCatePropertyV2(35237) fmt.Println("err=====", err) + globals.SugarLogger.Debugf("data:=%s", utils.Format4Output(data, false)) fmt.Println("data====", data) // 202209281558450102081001701D7B32C5 } @@ -328,6 +329,10 @@ func TestGetSkuList(t *testing.T) { }) } +func TestGetBrandId(t *testing.T) { + a.GetSkuBrand(29146) +} + func Test11111(t *testing.T) { fmt.Println((1 & 1) != 0) fmt.Println(1&2 == 0) From 78c1d0103ecc9e1ee58de0898c5a65604bed3d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 25 Oct 2022 17:38:11 +0800 Subject: [PATCH 2/3] 1 --- platformapi/jdapi/jdapi.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platformapi/jdapi/jdapi.go b/platformapi/jdapi/jdapi.go index bec81824..55551f2d 100644 --- a/platformapi/jdapi/jdapi.go +++ b/platformapi/jdapi/jdapi.go @@ -6,6 +6,7 @@ import ( "encoding/json" "errors" "fmt" + "git.rosy.net.cn/jx-callback/globals" "net/http" "reflect" "sort" @@ -284,6 +285,7 @@ func (a *API) AccessAPINoPage2(apiStr string, jdParams map[string]interface{}, k if jsonResult["code"].(string) != "0" { return nil, errors.New(jsonResult["msg"].(string)) } + globals.SugarLogger.Debugf("====AccessAPINoPage2============%s", utils.Format4Output(jsonResult, false)) var data map[string]interface{} if err := utils.UnmarshalUseNumber([]byte(jsonResult["data"].(string)), &data); err != nil { return nil, platformapi.ErrResponseDataFormatWrong From 2249d006f9163585c81e94890be828ee86d50049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 25 Oct 2022 20:11:53 +0800 Subject: [PATCH 3/3] 1 --- platformapi/jdapi/jdapi.go | 3 +++ platformapi/tiktok_shop/tiktok_api/afs_test.go | 6 +++++- platformapi/tiktok_shop/tiktok_api/order_type_const.go | 10 +++++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/platformapi/jdapi/jdapi.go b/platformapi/jdapi/jdapi.go index 55551f2d..747686fe 100644 --- a/platformapi/jdapi/jdapi.go +++ b/platformapi/jdapi/jdapi.go @@ -285,6 +285,9 @@ func (a *API) AccessAPINoPage2(apiStr string, jdParams map[string]interface{}, k if jsonResult["code"].(string) != "0" { return nil, errors.New(jsonResult["msg"].(string)) } + if jsonResult["data"] == nil || utils.IsNil(jsonResult["data"]) { + return nil, errors.New("data is nil") + } globals.SugarLogger.Debugf("====AccessAPINoPage2============%s", utils.Format4Output(jsonResult, false)) var data map[string]interface{} if err := utils.UnmarshalUseNumber([]byte(jsonResult["data"].(string)), &data); err != nil { diff --git a/platformapi/tiktok_shop/tiktok_api/afs_test.go b/platformapi/tiktok_shop/tiktok_api/afs_test.go index 12f31489..c9ccf4a8 100644 --- a/platformapi/tiktok_shop/tiktok_api/afs_test.go +++ b/platformapi/tiktok_shop/tiktok_api/afs_test.go @@ -2,6 +2,8 @@ package tiktok_api import ( "fmt" + "git.rosy.net.cn/baseapi/utils" + "git.rosy.net.cn/jx-callback/globals" "testing" ) @@ -20,7 +22,9 @@ func TestAggreOrNotAggreAfs(t *testing.T) { } func TestGetSkuDetailLocalID(t *testing.T) { - a.GetSkuDetailLocalID("", "609483111") + data, err := a.GetSkuDetailLocalID("", "30644") + globals.SugarLogger.Debugf("data=%s", utils.Format4Output(data, false)) + globals.SugarLogger.Debugf("data=%s", err) } // diff --git a/platformapi/tiktok_shop/tiktok_api/order_type_const.go b/platformapi/tiktok_shop/tiktok_api/order_type_const.go index 240db8aa..bba0833e 100644 --- a/platformapi/tiktok_shop/tiktok_api/order_type_const.go +++ b/platformapi/tiktok_shop/tiktok_api/order_type_const.go @@ -157,16 +157,16 @@ const ( // 501 7 6,27 同意补寄 // 502 7 6 拒绝补寄 const ( - AfterSaleEmuAgreeToReturnOneApply = 101 // 同意退货申请(一次审核) Logistics.ReceiverAddressId 或 Logistics.AfterSaleAddressDetail + AfterSaleEmuAgreeToReturnOneApply = 101 // 同意退货申请(一次审核)不接 Logistics.ReceiverAddressId 或 Logistics.AfterSaleAddressDetail AfterSaleEmuRefuseToReturnOneApply = 102 // 拒绝退货申请(一次审核) reason , evidence - AfterSaleEmuAgreeToReturnTwoApply = 111 // 同意退货(二次审核) + AfterSaleEmuAgreeToReturnTwoApply = 111 // 同意退货(二次审核) 不接 AfterSaleEmuRefuseToReturnTwoApply = 112 // 拒绝退货 (二次审核) reason , evidence AfterSaleEmuReturnGoodsToRefundApply = 121 // 退货转退款 AfterSaleEmuAgreeOnlyRefundApply = 201 // 同意仅退款 AfterSaleEmuRefuseOnlyRefundApply = 202 // 拒绝仅退款 reason , evidence - AfterSaleEmuRefundAfterRefusalApply = 203 // 同意拒签后退款 - AfterSaleEmuAgreeChangeGoodsOneApply = 301 // 同意换货申请(一次审核) Logistics.ReceiverAddressId 或 Logistics.AfterSaleAddressDetail - AfterSaleEmuRefundChangeGoodsOneApply = 302 // 拒绝换货申请(一次审核) reason,evidence + AfterSaleEmuRefundAfterRefusalApply = 203 // 同意拒签后退款 不接 + AfterSaleEmuAgreeChangeGoodsOneApply = 301 // 同意换货申请(一次审核) 不接 Logistics.ReceiverAddressId 或 Logistics.AfterSaleAddressDetail + AfterSaleEmuRefundChangeGoodsOneApply = 302 // 拒绝换货申请(一次审核) reason,evidence AfterSaleEmuAgreeChangeGoodsTwoApply = 311 // 同意换货(二次审核) logistics.companyCode,logistics.logisticsCode AfterSaleEmuRefundChangeGoodsTwoApply = 312 // 拒绝换货(二次审核) reason,evidence AfterSaleEmuChangeGoodsToRefundApply = 321 // 换货转退款