1
This commit is contained in:
@@ -2,6 +2,8 @@ package brand_list_request
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
brand_list_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/brand_list/response"
|
||||||
|
doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BrandListRequest struct {
|
type BrandListRequest struct {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package brand_list_response
|
package brand_list_response
|
||||||
|
|
||||||
|
import doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||||
|
|
||||||
type BrandListResponse struct {
|
type BrandListResponse struct {
|
||||||
doudian_sdk.BaseDoudianOpApiResponse
|
doudian_sdk.BaseDoudianOpApiResponse
|
||||||
Data *BrandListData `json:"data"`
|
Data *BrandListData `json:"data"`
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package tiktok_api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
brand_list_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/brand_list/request"
|
||||||
product_addV2_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_addV2/request"
|
product_addV2_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_addV2/request"
|
||||||
product_addV2_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_addV2/response"
|
product_addV2_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_addV2/response"
|
||||||
product_del_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_del/request"
|
product_del_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_del/request"
|
||||||
@@ -231,3 +232,22 @@ func (a *API) EditPrice(skuPrice *sku_editPrice_request.SkuEditPriceParam) error
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetSkuBrand 获取商品所属品牌
|
||||||
|
func (a *API) GetSkuBrand(categoryId int64) (int64, error) {
|
||||||
|
request := brand_list_request.New()
|
||||||
|
request.Param.CategoryId = categoryId
|
||||||
|
result, err := request.Execute(a.accessTokenObj)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
if result.Code != RequestSuccessCode {
|
||||||
|
return 0, errors.New(result.SubMsg)
|
||||||
|
}
|
||||||
|
|
||||||
|
if result.Data == nil || len(result.Data.AuthBrandList) == 0 {
|
||||||
|
return 596120136, nil // 无品牌默认值
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.Data.AuthBrandList[0].BrandId, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ func TestCreateStoreCommodity(t *testing.T) {
|
|||||||
//SubstituteGoodsUrl: "",
|
//SubstituteGoodsUrl: "",
|
||||||
//SaleChannelType: "",
|
//SaleChannelType: "",
|
||||||
//RecruitInfo: nil,
|
//RecruitInfo: nil,
|
||||||
StoreId: 0,
|
//StoreId: 0,
|
||||||
//MainProductId: 0,
|
//MainProductId: 0,
|
||||||
//SaleLimitId: 0,
|
//SaleLimitId: 0,
|
||||||
//NamePrefix: "",
|
//NamePrefix: "",
|
||||||
|
|||||||
Reference in New Issue
Block a user