From 49a780f92ed7272c40112fd22e664894d4c27158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Tue, 1 Nov 2022 18:58:47 +0800 Subject: [PATCH] 1 --- platformapi/mtpsapi/mtpsapi.go | 6 +++-- platformapi/mtpsapi/mtpsapi_test.go | 22 +++++++++---------- .../tiktok_shop/tiktok_api/afs_test.go | 4 ++-- platformapi/tiktok_shop/tiktok_api/order.go | 1 + platformapi/tiktok_shop/tiktok_api/sku.go | 2 +- .../tiktok_shop/tiktok_api/sku_test.go | 17 ++++++++------ .../tiktok_shop/tiktok_api/store_test.go | 8 +++---- 7 files changed, 32 insertions(+), 28 deletions(-) diff --git a/platformapi/mtpsapi/mtpsapi.go b/platformapi/mtpsapi/mtpsapi.go index 153cb56c..6c09ab98 100644 --- a/platformapi/mtpsapi/mtpsapi.go +++ b/platformapi/mtpsapi/mtpsapi.go @@ -57,13 +57,15 @@ var ( const ( DeliveryServiceCodeSuperRapid = 4002 // 飞速达 - DeliveryServiceCodeRapid = 100004 // 快速达 - DeliveryServiceCodeIntime = 100006 // 及时达 + DeliveryServiceCodeRapid = 100029 // 快速达,时效型 + DeliveryServiceLocalDa = 100009 // 同城达 + DeliveryServiceCodeIntime = 100006 // 及时达(这个暂时没用) DeliveryServiceCodeTogether = 4013 // 集中送 //DeliveryServiceCodeSuperRapid = 4002 // 飞速达 //DeliveryServiceCodeRapid = 4011 // 快速达 //DeliveryServiceCodeIntime = 100006 // 及时达 //DeliveryServiceCodeTogether = 4013 // 集中送 + ) const ( diff --git a/platformapi/mtpsapi/mtpsapi_test.go b/platformapi/mtpsapi/mtpsapi_test.go index 3b0515b9..65f43913 100644 --- a/platformapi/mtpsapi/mtpsapi_test.go +++ b/platformapi/mtpsapi/mtpsapi_test.go @@ -64,17 +64,17 @@ func TestCreateOrderByShop(t *testing.T) { DeliveryID: 123456789, OrderID: "order_123456789", // 设置测试门店 id,测试门店的坐标地址为 97235456,31065079(高德坐标),配送范围3km - ShopID: "test_0001", - DeliveryServiceCode: DeliveryServiceCodeIntime, - ReceiverName: "xjh", - ReceiverAddress: "九里堤", - ReceiverPhone: "18112345678", - ReceiverLng: 97235456, - ReceiverLat: 31065079, - CoordinateType: CoordinateTypeMars, - GoodsValue: 12.34, - GoodsWeight: 3.4, - OrderType: OrderTypeASAP, + ShopID: "test_0001", + //DeliveryServiceCode: DeliveryServiceCodeIntime, + ReceiverName: "xjh", + ReceiverAddress: "九里堤", + ReceiverPhone: "18112345678", + ReceiverLng: 97235456, + ReceiverLat: 31065079, + CoordinateType: CoordinateTypeMars, + GoodsValue: 12.34, + GoodsWeight: 3.4, + OrderType: OrderTypeASAP, } order, err := api.CreateOrderByShop2(basicParams) diff --git a/platformapi/tiktok_shop/tiktok_api/afs_test.go b/platformapi/tiktok_shop/tiktok_api/afs_test.go index 01310670..da6b2735 100644 --- a/platformapi/tiktok_shop/tiktok_api/afs_test.go +++ b/platformapi/tiktok_shop/tiktok_api/afs_test.go @@ -7,8 +7,8 @@ import ( "testing" ) -var token = `{"access_token":"c4afc5bc-7ddf-4244-b35a-0c393f3dca32","expires_in":1667203717,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"5a4f9dfe-306b-4bca-8b35-2ae9afc0245e","authority_id":""}` -var a = New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", "") +var token = `{"access_token":"d590b649-0dd9-4988-a5e2-bf7e06e2f105","expires_in":1667808519,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"f57c6a55-af5f-45ca-8ade-b2282be86341","authority_id":""}` +var a = New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token) // 查询售后单详情 func TestAfsOrder(t *testing.T) { diff --git a/platformapi/tiktok_shop/tiktok_api/order.go b/platformapi/tiktok_shop/tiktok_api/order.go index 9e91608e..87b1a6af 100644 --- a/platformapi/tiktok_shop/tiktok_api/order.go +++ b/platformapi/tiktok_shop/tiktok_api/order.go @@ -153,6 +153,7 @@ func (a *API) AfterSaleOperate(refundType int32, refundId, remark string, storeI param.Items = refundListParam // 同意退货 result, err := request.Execute(a.accessTokenObj) + globals.SugarLogger.Debugf("====AfterSaleOperate:=%s", utils.Format4Output(result, false)) if err != nil { return err } diff --git a/platformapi/tiktok_shop/tiktok_api/sku.go b/platformapi/tiktok_shop/tiktok_api/sku.go index d2adc74a..fea4d869 100644 --- a/platformapi/tiktok_shop/tiktok_api/sku.go +++ b/platformapi/tiktok_shop/tiktok_api/sku.go @@ -141,6 +141,7 @@ func (a *API) EditStoreCommodity(sku *product_editV2_request.ProductEditV2Param) request.Param = sku result, err := request.Execute(a.accessTokenObj) + globals.SugarLogger.Debugf("编辑门店============%s", utils.Format4Output(result, false)) if err != nil { return err } @@ -211,7 +212,6 @@ func (a *API) GetSkuDetail(productId, outProductId string) (*product_detail_resp } result, err := request.Execute(a.accessTokenObj) - globals.SugarLogger.Debugf("%s", utils.Format4Output(result, false)) if err != nil { return nil, err } diff --git a/platformapi/tiktok_shop/tiktok_api/sku_test.go b/platformapi/tiktok_shop/tiktok_api/sku_test.go index 484ff796..355dbaf2 100644 --- a/platformapi/tiktok_shop/tiktok_api/sku_test.go +++ b/platformapi/tiktok_shop/tiktok_api/sku_test.go @@ -218,7 +218,7 @@ func TestInt16(t *testing.T) { // 查询商品详情(抖音平台id) func TestGetSkuDetail(t *testing.T) { - data, err := a.GetSkuDetail("3579136668340475469", "") + data, err := a.GetSkuDetail("3580251132888538614", "") fmt.Println(err) globals.SugarLogger.Debugf("====%s", utils.Format4Output(data, false)) } @@ -263,18 +263,21 @@ func TestEiduPrice(t *testing.T) { // s上架1 func TestEditStoreCommodity(t *testing.T) { - accesstoken := `{"access_token":"60f530b2-9ab6-4723-b487-c094918f0d21","expires_in":1666257163,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"1220666a-5e88-458c-a8c0-06d949fbbd3f","authority_id":""}` - a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", accesstoken) + data, _ := a.GetSkuDetail("3580251132888538614", "") + globals.SugarLogger.Debugf("=============%s", data.ProductFormatNew) + specPrice, _ := json.Marshal(data.SpecPrices) + specs, _ := json.Marshal(data.Specs) a.EditStoreCommodity(&product_editV2_request.ProductEditV2Param{ - ProductId: 3576377564144516403, - Commit: true, + ProductId: 1748169491056643, + ProductFormatNew: data.ProductFormatNew, + SpecPrices: string(specPrice), + Specs: string(specs), + Commit: true, }) } // 上架2 func TestEditStoreCommodity2(t *testing.T) { - token := `{"access_token":"a1746210-a8a3-4497-a87b-09d1f10dbb95","expires_in":1665652230,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"c1cf8d88-0983-4f2a-b969-3746fae6b0cd","authority_id":""}` - a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token) a.EditStoreCommodityCommit(&product_editV2_commit_request.ProductEditV2Param2{ ProductId: 3576377564144516403, Commit: true, diff --git a/platformapi/tiktok_shop/tiktok_api/store_test.go b/platformapi/tiktok_shop/tiktok_api/store_test.go index 83d3c944..2190fd1a 100644 --- a/platformapi/tiktok_shop/tiktok_api/store_test.go +++ b/platformapi/tiktok_shop/tiktok_api/store_test.go @@ -236,12 +236,10 @@ func TestUnsuspendStore(t *testing.T) { } func TestUpdateStore(t *testing.T) { - accesstoken := `{"access_token":"60f530b2-9ab6-4723-b487-c094918f0d21","expires_in":1666257163,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"1220666a-5e88-458c-a8c0-06d949fbbd3f","authority_id":""}` - a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", accesstoken) param := &shop_editStore_request.ShopEditStoreParam{ - StoreId: 65312663, + StoreId: 65402632, StoreCode: "", - Name: "测试门店修改1019", + Name: "", Province: "", City: "", District: "", @@ -250,7 +248,7 @@ func TestUpdateStore(t *testing.T) { Longitude: "", Latitude: "", OpenTime: &shop_editStore_request.OpenTime{DayMap: map[int64]string{ - 1: "07:00-12:00 14:00-18:00", + 1: "07:00-20:00", 2: "07:00-20:00", 3: "07:00-20:00", 4: "07:00-20:00", 5: "07:00-20:00", 6: "07:00-20:00", 7: "07:00-20:00", }}, } err := a.EditStore(param)