1
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package tiktok_api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"time"
|
||||
@@ -16,7 +17,17 @@ type Api struct {
|
||||
expiresIn int64
|
||||
}
|
||||
|
||||
func New(appKey, appSecret string) *Api {
|
||||
func New(appKey, appSecret, accessToken string) *Api {
|
||||
var access *doudian_sdk.AccessToken
|
||||
if accessToken != "" {
|
||||
if err := json.Unmarshal([]byte(accessToken), &access); err != nil {
|
||||
globals.SugarLogger.Debug("accessToken init err :", err)
|
||||
return nil
|
||||
} else {
|
||||
AccessToken = access
|
||||
}
|
||||
}
|
||||
|
||||
return &Api{
|
||||
appKey: appKey,
|
||||
appSecret: appSecret,
|
||||
|
||||
@@ -1,15 +1,25 @@
|
||||
package tiktok_api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
order_orderDetail_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_orderDetail/request"
|
||||
order_orderDetail_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_orderDetail/response"
|
||||
)
|
||||
|
||||
// GetTiktokOrderDetail 获取订单详情
|
||||
func (a *Api) GetTiktokOrderDetail(storeId string) {
|
||||
func (a *Api) GetTiktokOrderDetail(orderId string) (*order_orderDetail_response.ShopOrderDetail, error) {
|
||||
reqParam := order_orderDetail_request.New()
|
||||
reqParam.Param = &order_orderDetail_request.OrderOrderDetailParam{
|
||||
ShopOrderId: storeId,
|
||||
ShopOrderId: orderId,
|
||||
IsSearchable: false,
|
||||
}
|
||||
reqParam.Execute(AccessToken)
|
||||
orderDetail, err := reqParam.Execute(AccessToken)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if orderDetail.Code != 1000 {
|
||||
return nil, errors.New(orderDetail.Msg)
|
||||
}
|
||||
|
||||
return orderDetail.Data.ShopOrderDetail, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user