Merge branch 'master' of https://e.coding.net/rosydev/baseapi
This commit is contained in:
@@ -50,9 +50,9 @@ type TokenCreateParam struct {
|
|||||||
// 授权类型 ;【工具型应用:authorization_code 自用型应用:authorization_self】
|
// 授权类型 ;【工具型应用:authorization_code 自用型应用:authorization_self】
|
||||||
GrantType string `json:"grant_type"`
|
GrantType string `json:"grant_type"`
|
||||||
// 判断测试店铺标识 ,非必传,若新增测试店铺传1,若不是则不必传
|
// 判断测试店铺标识 ,非必传,若新增测试店铺传1,若不是则不必传
|
||||||
TestShop string `json:"test_shop"`
|
//TestShop string `json:"test_shop"`
|
||||||
// 店铺ID
|
//// 店铺ID
|
||||||
ShopId string `json:"shop_id"`
|
//ShopId string `json:"shop_id"`
|
||||||
// 授权id,用于替换shopId
|
// 授权id,用于替换shopId
|
||||||
AuthId string `json:"auth_id"`
|
AuthId string `json:"auth_id"`
|
||||||
// 授权主体类型
|
// 授权主体类型
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ func TestAfsOrder(t *testing.T) {
|
|||||||
|
|
||||||
// 同意/拒绝售后单
|
// 同意/拒绝售后单
|
||||||
func TestAggreOrNotAggreAfs(t *testing.T) {
|
func TestAggreOrNotAggreAfs(t *testing.T) {
|
||||||
//a.AfterSaleOperate()
|
a.AfterSaleOperate(int32(201), "4994452108005135590", "1", 0)
|
||||||
fmt.Println("11", 8|16|32|1)
|
fmt.Println("11", 8|16|32|1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,5 +29,5 @@ func TestGetSkuDetailLocalID(t *testing.T) {
|
|||||||
|
|
||||||
//
|
//
|
||||||
func TestName(t *testing.T) {
|
func TestName(t *testing.T) {
|
||||||
a.GetSkuDetail("3576800536843975894", "")
|
a.GetSkuDetail("3579733194175557759", "") // 主品
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ func TestApi(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestQueryOrderDetail(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", utils.Format4Output(data, false))
|
||||||
globals.SugarLogger.Debugf("=====%s", err)
|
globals.SugarLogger.Debugf("=====%s", err)
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ func TestSendGoods(t *testing.T) {
|
|||||||
|
|
||||||
// 创建物流token
|
// 创建物流token
|
||||||
func TestCreateExpss(t *testing.T) {
|
func TestCreateExpss(t *testing.T) {
|
||||||
a := NewExpress("7152420904331429407", "cc7ba367-2394-4cbb-81c6-26f0e929d1c6", "")
|
a := NewExpress("7153997323561879075", "3517d3ea-b96b-4379-a7a4-2d9389e8ffeb", "")
|
||||||
a.CreateToken()
|
a.CreateToken()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,8 +47,9 @@ func NewExpress(appKey, appSecret, accessToken string) *APIExpress {
|
|||||||
return api
|
return api
|
||||||
}
|
}
|
||||||
return &APIExpress{
|
return &APIExpress{
|
||||||
appKey: appKey,
|
appKey: appKey,
|
||||||
appSecret: appSecret,
|
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)
|
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{
|
a.accessTokenObj.CreateTokenData = doudian_sdk.CreateTokenData{
|
||||||
AccessToken: response.Data.AccessToken,
|
AccessToken: response.Data.AccessToken,
|
||||||
ExpiresIn: time.Now().Unix() + response.Data.ExpiresIn,
|
ExpiresIn: response.Data.ExpiresIn,
|
||||||
Scope: response.Data.Scope,
|
Scope: response.Data.Scope,
|
||||||
ShopId: response.Data.ShopId,
|
ShopId: response.Data.ShopId,
|
||||||
ShopName: response.Data.ShopName,
|
ShopName: response.Data.ShopName,
|
||||||
RefreshToken: response.Data.RefreshToken,
|
RefreshToken: response.Data.RefreshToken,
|
||||||
AuthorityId: response.Data.AuthorityId,
|
AuthorityId: response.Data.AuthorityId,
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.Data, nil
|
return response.Data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,6 +145,7 @@ func (a *APIExpress) OrderStatusAndPsInfo(param map[string]interface{}) error {
|
|||||||
psInfo.TraceMsgs = traceMsgs
|
psInfo.TraceMsgs = traceMsgs
|
||||||
request.Param = psInfo
|
request.Param = psInfo
|
||||||
|
|
||||||
|
globals.SugarLogger.Debugf("OrderStatusAndPsInfo=========:%s", utils.Format4Output(request.Param, false))
|
||||||
if a.accessTokenObj == nil || a.accessTokenObj.CreateTokenData.AccessToken == "" {
|
if a.accessTokenObj == nil || a.accessTokenObj.CreateTokenData.AccessToken == "" {
|
||||||
a.CreateToken()
|
a.CreateToken()
|
||||||
} else if a.accessTokenObj.CreateTokenData.ExpiresIn < time.Now().Unix() {
|
} else if a.accessTokenObj.CreateTokenData.ExpiresIn < time.Now().Unix() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package tiktok_api
|
package tiktok_api
|
||||||
|
|
||||||
const RequestSuccessCode = 10000
|
const RequestSuccessCode = 10000
|
||||||
const TiktokExpressCode = "chengduruoxi"
|
const TiktokExpressCode = "chengdouruoxi"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CallbackSuccessCode = 0
|
CallbackSuccessCode = 0
|
||||||
|
|||||||
@@ -111,8 +111,6 @@ func (a *API) CreateStoreCommodity(skuParam *product_addV2_request.ProductAddV2P
|
|||||||
request.Param = skuParam
|
request.Param = skuParam
|
||||||
|
|
||||||
result, err := request.Execute(a.accessTokenObj)
|
result, err := request.Execute(a.accessTokenObj)
|
||||||
globals.SugarLogger.Debugf("创建子商品,创建主商品=========%s", utils.Format4Output(result, false))
|
|
||||||
globals.SugarLogger.Debugf("创建子商品,创建主商品=========%s", err)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,9 +44,6 @@ func TestGetCatePropertyV2(t *testing.T) {
|
|||||||
|
|
||||||
// 新增总部商品
|
// 新增总部商品
|
||||||
func TestCreateStoreCommodity(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{
|
param := &product_addV2_request.ProductAddV2Param{
|
||||||
//ProductType: 0,
|
//ProductType: 0,
|
||||||
CategoryLeafId: 29146,
|
CategoryLeafId: 29146,
|
||||||
@@ -235,12 +232,12 @@ func TestGetSkuDetailLocalId(t *testing.T) {
|
|||||||
|
|
||||||
func TestUpdateSkuStore(t *testing.T) {
|
func TestUpdateSkuStore(t *testing.T) {
|
||||||
err := a.UpdateSkuStock(&sku_syncStock_request.SkuSyncStockParam{
|
err := a.UpdateSkuStock(&sku_syncStock_request.SkuSyncStockParam{
|
||||||
SkuId: 1747916506404884,
|
SkuId: 1747916594479148,
|
||||||
ProductId: 3579733194175557759,
|
ProductId: 3579733194175557759,
|
||||||
OutProductId: 0,
|
OutProductId: 0,
|
||||||
Incremental: false,
|
Incremental: false,
|
||||||
IdempotentId: "",
|
IdempotentId: "",
|
||||||
StockNum: 1,
|
StockNum: 2,
|
||||||
OutWarehouseId: "65402632",
|
OutWarehouseId: "65402632",
|
||||||
Code: "",
|
Code: "",
|
||||||
OutSkuId: 0,
|
OutSkuId: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user