From 9b6eafc1b295ae897a2dc49d18b94126576ade24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 24 Oct 2022 17:33:00 +0800 Subject: [PATCH] 1 --- platformapi/jdshopapi/store_page.go | 4 +--- platformapi/platformapi.go | 3 --- .../tiktok_shop/sdk-golang/core/create_token_request.go | 2 +- platformapi/tiktok_shop/tiktok_api/afs_test.go | 2 +- platformapi/tiktok_shop/tiktok_api/api.go | 1 + platformapi/tiktok_shop/tiktok_api/api_test.go | 2 +- platformapi/tiktok_shop/tiktok_api/logistics_express.go | 2 +- 7 files changed, 6 insertions(+), 10 deletions(-) diff --git a/platformapi/jdshopapi/store_page.go b/platformapi/jdshopapi/store_page.go index d4410a55..ec7239d9 100644 --- a/platformapi/jdshopapi/store_page.go +++ b/platformapi/jdshopapi/store_page.go @@ -512,7 +512,7 @@ func (a *API) AllOrders(allOrdersParam *AllOrdersParam) (allOrdersResult *AllOrd "orderId": allOrdersParam.OrderID, }, true) - result2, err := a.AccessStorePage2("https://porder.shop.jd.com/order/orderlist", map[string]interface{}{ + _, err = a.AccessStorePage2("https://porder.shop.jd.com/order/orderlist", map[string]interface{}{ "current": allOrdersParam.Current, "pageSize": allOrdersParam.PageSize, "selectedTabName": "allOrders", @@ -522,8 +522,6 @@ func (a *API) AllOrders(allOrdersParam *AllOrdersParam) (allOrdersResult *AllOrd //"orderStatusArray": allOrdersParam.OrderStatusArray, //"orderId": allOrdersParam.OrderID, }, true) - fmt.Println("尝试扒订单===============1 ", result) - fmt.Println("尝试扒订单===============2 ", result2) if err == nil { utils.Map2StructByJson(result, &allOrdersResult, false) } diff --git a/platformapi/platformapi.go b/platformapi/platformapi.go index 015ab8d6..f1d92614 100644 --- a/platformapi/platformapi.go +++ b/platformapi/platformapi.go @@ -173,7 +173,6 @@ func AccessPlatformAPIWithRetry(client *http.Client, handleRequest func() *http. baseapi.SugarLogger.Errorf("AccessPlatformAPIWithRetry:%s ioutil.ReadAll failed, url:%v, error:%v", trackInfo, request.URL, err) errLevel = ErrLevelRecoverableErr // 读取数据错误,或数据格式错误认为是偶发情况,重试 } else { - //baseapi.SugarLogger.Debugf("AccessPlatformAPIWithRetry:%s url:%v, response:%s", trackInfo, request.URL, string(bodyData)) if err = utils.TryUnmarshalUseNumber(bodyData, &bodyGeneral); err != nil { parseJSONErr = err err = nil // 尝试忽略解析成json错 @@ -197,7 +196,6 @@ func AccessPlatformAPIWithRetry(client *http.Client, handleRequest func() *http. if bodyDataLen > maxOutputLen { bodyData2 = bodyData2[:maxOutputLen] } - baseapi.SugarLogger.Infof("AccessPlatformAPIWithRetry:%s TryUnmarshalUseNumber failed, url:%v, error:%v", trackInfo, request.URL, parseJSONErr) } } @@ -219,7 +217,6 @@ func AccessPlatformAPIWithRetry(client *http.Client, handleRequest func() *http. continue } } - baseapi.SugarLogger.Infof("AccessPlatformAPIWithRetry:%s failed, url:%v, error:%v", trackInfo, request.URL, err) return err } } diff --git a/platformapi/tiktok_shop/sdk-golang/core/create_token_request.go b/platformapi/tiktok_shop/sdk-golang/core/create_token_request.go index 5f7fd0c5..bbb836ca 100644 --- a/platformapi/tiktok_shop/sdk-golang/core/create_token_request.go +++ b/platformapi/tiktok_shop/sdk-golang/core/create_token_request.go @@ -67,7 +67,7 @@ type CreateTokenData struct { Scope string `json:"scope"` //店铺ID - ShopId string `json:"shop_id"` + ShopId int64 `json:"shop_id"` //店铺名称 ShopName string `json:"shop_name"` diff --git a/platformapi/tiktok_shop/tiktok_api/afs_test.go b/platformapi/tiktok_shop/tiktok_api/afs_test.go index c50bf31f..4c694508 100644 --- a/platformapi/tiktok_shop/tiktok_api/afs_test.go +++ b/platformapi/tiktok_shop/tiktok_api/afs_test.go @@ -6,7 +6,7 @@ import ( ) var token = `{"access_token":"47690a84-3cc2-4958-abf9-41cc7fca5f82","expires_in":1666862533,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"66ea2395-07c7-409d-84ae-93ac1e600b74","authority_id":""}` -var a = New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token) +var a = New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", "") // 查询售后单详情 func TestAfsOrder(t *testing.T) { diff --git a/platformapi/tiktok_shop/tiktok_api/api.go b/platformapi/tiktok_shop/tiktok_api/api.go index 6b5006c4..f19c7724 100644 --- a/platformapi/tiktok_shop/tiktok_api/api.go +++ b/platformapi/tiktok_shop/tiktok_api/api.go @@ -78,6 +78,7 @@ func (a *API) CreateToken(code string) (*doudian_sdk.CreateTokenData, error) { a.refreshToken = access.RefreshToken a.expiresIn = time.Now().Unix() + access.ExpiresIn a.accessTokenObj = access + access.CreateTokenData.ExpiresIn = a.expiresIn return &access.CreateTokenData, nil } diff --git a/platformapi/tiktok_shop/tiktok_api/api_test.go b/platformapi/tiktok_shop/tiktok_api/api_test.go index ca2064d6..12ff6738 100644 --- a/platformapi/tiktok_shop/tiktok_api/api_test.go +++ b/platformapi/tiktok_shop/tiktok_api/api_test.go @@ -30,7 +30,7 @@ func TestQueryOrderDetail(t *testing.T) { } func TestRefaseToken(t *testing.T) { - a.CreateToken("c2bcf85f-f8de-4c9e-bcdc-97d792ce7156") + a.CreateToken("5f4aa6cd-c50b-4770-9085-1ed75e8bb558") //a.RefreshToken() // {"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":""} //{"access_token":"37f41ac7-49ac-4848-a0ee-ea86bb0dfd9f","expires_in":519389,"scope":"SCOPE","shop_id":"","shop_name":"抖店开放平台测试专用店","refresh_token":"3dd8f638-fdf1-46e7-b974-88df382f03c6","authority_id" :""} diff --git a/platformapi/tiktok_shop/tiktok_api/logistics_express.go b/platformapi/tiktok_shop/tiktok_api/logistics_express.go index fe028e2e..d8bd2b25 100644 --- a/platformapi/tiktok_shop/tiktok_api/logistics_express.go +++ b/platformapi/tiktok_shop/tiktok_api/logistics_express.go @@ -72,7 +72,7 @@ func (a *APIExpress) CreateToken() (*token_create_response.TokenCreateData, erro AccessToken: response.Data.AccessToken, ExpiresIn: time.Now().Unix() + response.Data.ExpiresIn, Scope: response.Data.Scope, - ShopId: utils.Int64ToStr(response.Data.ShopId), + ShopId: response.Data.ShopId, ShopName: response.Data.ShopName, RefreshToken: response.Data.RefreshToken, AuthorityId: response.Data.AuthorityId,