This commit is contained in:
richboo111
2022-10-31 15:00:59 +08:00
7 changed files with 19 additions and 19 deletions

View File

@@ -50,9 +50,9 @@ type TokenCreateParam struct {
// 授权类型 ;【工具型应用:authorization_code 自用型应用:authorization_self】
GrantType string `json:"grant_type"`
// 判断测试店铺标识 非必传若新增测试店铺传1若不是则不必传
TestShop string `json:"test_shop"`
// 店铺ID
ShopId string `json:"shop_id"`
//TestShop string `json:"test_shop"`
//// 店铺ID
//ShopId string `json:"shop_id"`
// 授权id用于替换shopId
AuthId string `json:"auth_id"`
// 授权主体类型

View File

@@ -17,7 +17,7 @@ func TestAfsOrder(t *testing.T) {
// 同意/拒绝售后单
func TestAggreOrNotAggreAfs(t *testing.T) {
//a.AfterSaleOperate()
a.AfterSaleOperate(int32(201), "4994452108005135590", "1", 0)
fmt.Println("11", 8|16|32|1)
}
@@ -29,5 +29,5 @@ func TestGetSkuDetailLocalID(t *testing.T) {
//
func TestName(t *testing.T) {
a.GetSkuDetail("3576800536843975894", "")
a.GetSkuDetail("3579733194175557759", "") // 主品
}

View File

@@ -22,7 +22,7 @@ func TestApi(t *testing.T) {
}
func TestQueryOrderDetail(t *testing.T) {
data, err := a.GetTiktokOrderDetail("4994075907516196260")
data, err := a.GetTiktokOrderDetail("4994436461423172838")
globals.SugarLogger.Debugf("=====%s", utils.Format4Output(data, false))
globals.SugarLogger.Debugf("=====%s", err)
}
@@ -56,7 +56,7 @@ func TestSendGoods(t *testing.T) {
// 创建物流token
func TestCreateExpss(t *testing.T) {
a := NewExpress("7152420904331429407", "cc7ba367-2394-4cbb-81c6-26f0e929d1c6", "")
a := NewExpress("7153997323561879075", "3517d3ea-b96b-4379-a7a4-2d9389e8ffeb", "")
a.CreateToken()
}

View File

@@ -47,8 +47,9 @@ func NewExpress(appKey, appSecret, accessToken string) *APIExpress {
return api
}
return &APIExpress{
appKey: appKey,
appSecret: appSecret,
appKey: appKey,
appSecret: appSecret,
accessTokenObj: new(doudian_sdk.AccessToken),
}
}
@@ -68,16 +69,19 @@ func (a *APIExpress) CreateToken() (*token_create_response.TokenCreateData, erro
return nil, errors.New(response.SubMsg)
}
a.accessToken = response.Data.AccessToken
a.expiresIn = time.Now().Unix() + response.Data.ExpiresIn
a.refreshToken = response.Data.RefreshToken
a.accessTokenObj.CreateTokenData = doudian_sdk.CreateTokenData{
AccessToken: response.Data.AccessToken,
ExpiresIn: time.Now().Unix() + response.Data.ExpiresIn,
ExpiresIn: response.Data.ExpiresIn,
Scope: response.Data.Scope,
ShopId: response.Data.ShopId,
ShopName: response.Data.ShopName,
RefreshToken: response.Data.RefreshToken,
AuthorityId: response.Data.AuthorityId,
}
return response.Data, nil
}
@@ -141,6 +145,7 @@ func (a *APIExpress) OrderStatusAndPsInfo(param map[string]interface{}) error {
psInfo.TraceMsgs = traceMsgs
request.Param = psInfo
globals.SugarLogger.Debugf("OrderStatusAndPsInfo=========:%s", utils.Format4Output(request.Param, false))
if a.accessTokenObj == nil || a.accessTokenObj.CreateTokenData.AccessToken == "" {
a.CreateToken()
} else if a.accessTokenObj.CreateTokenData.ExpiresIn < time.Now().Unix() {

View File

@@ -1,7 +1,7 @@
package tiktok_api
const RequestSuccessCode = 10000
const TiktokExpressCode = "chengduruoxi"
const TiktokExpressCode = "chengdouruoxi"
const (
CallbackSuccessCode = 0

View File

@@ -111,8 +111,6 @@ func (a *API) CreateStoreCommodity(skuParam *product_addV2_request.ProductAddV2P
request.Param = skuParam
result, err := request.Execute(a.accessTokenObj)
globals.SugarLogger.Debugf("创建子商品,创建主商品=========%s", utils.Format4Output(result, false))
globals.SugarLogger.Debugf("创建子商品,创建主商品=========%s", err)
if err != nil {
return nil, err
}

View File

@@ -44,9 +44,6 @@ func TestGetCatePropertyV2(t *testing.T) {
// 新增总部商品
func TestCreateStoreCommodity(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 := &product_addV2_request.ProductAddV2Param{
//ProductType: 0,
CategoryLeafId: 29146,
@@ -235,12 +232,12 @@ func TestGetSkuDetailLocalId(t *testing.T) {
func TestUpdateSkuStore(t *testing.T) {
err := a.UpdateSkuStock(&sku_syncStock_request.SkuSyncStockParam{
SkuId: 1747916506404884,
SkuId: 1747916594479148,
ProductId: 3579733194175557759,
OutProductId: 0,
Incremental: false,
IdempotentId: "",
StockNum: 1,
StockNum: 2,
OutWarehouseId: "65402632",
Code: "",
OutSkuId: 0,