This commit is contained in:
邹宗楠
2022-10-24 17:33:00 +08:00
parent 370d709c0c
commit 9b6eafc1b2
7 changed files with 6 additions and 10 deletions

View File

@@ -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)
}

View File

@@ -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
}
}

View File

@@ -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"`

View File

@@ -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) {

View File

@@ -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
}

View File

@@ -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" :""}

View File

@@ -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,