修改抖音商城商品创建
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package product_qualificationConfig_response
|
package product_qualificationConfig_response
|
||||||
|
|
||||||
|
import doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||||
|
|
||||||
type ProductQualificationConfigResponse struct {
|
type ProductQualificationConfigResponse struct {
|
||||||
doudian_sdk.BaseDoudianOpApiResponse
|
doudian_sdk.BaseDoudianOpApiResponse
|
||||||
Data *ProductQualificationConfigData `json:"data"`
|
Data *ProductQualificationConfigData `json:"data"`
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import (
|
|||||||
// "authority_id": ""
|
// "authority_id": ""
|
||||||
//}`
|
//}`
|
||||||
|
|
||||||
var token = `{"access_token":"58264f66-1417-455c-ab52-57254ebeae55","expires_in":1681371082,"scope":"SCOPE","shop_id":68032645,"shop_name":"美好菜市","refresh_token":"edc684c0-a7ef-44e0-afdc-1d61689667c3","authority_id":""}`
|
var token = `{"access_token":"b558d5bd-d55d-4322-8602-85ba449cbc79","expires_in":1681667840,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"3a3c0ad2-bcbd-4f55-b7af-6b406dabc47a","authority_id":""}`
|
||||||
|
|
||||||
//var token = `{"access_token":"e3173e9f-266f-4d87-88e7-e7cd837bc9d9","expires_in":1672882632,"scope":"SCOPE","shop_id":68023619,"shop_name":"京西到家","refresh_token":"5070aae2-493f-46bd-b5d6-6ea0cd64729f","authority_id":""}`
|
//var token = `{"access_token":"e3173e9f-266f-4d87-88e7-e7cd837bc9d9","expires_in":1672882632,"scope":"SCOPE","shop_id":68023619,"shop_name":"京西到家","refresh_token":"5070aae2-493f-46bd-b5d6-6ea0cd64729f","authority_id":""}`
|
||||||
|
|
||||||
|
|||||||
@@ -298,9 +298,6 @@ func (a *API) ConfirmReceivedReturnGoods(afsOrderId int64, agree bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CancelSendGoodsSuccess 商家在未发货仅退款途中发送取消发货状态
|
|
||||||
func (a *API) CancelSendGoodsSuccess() {}
|
|
||||||
|
|
||||||
// OrderDelivering 订单发货
|
// OrderDelivering 订单发货
|
||||||
// 暂时只支持整单出库,即接口调用时入参只能传父订单号。
|
// 暂时只支持整单出库,即接口调用时入参只能传父订单号。
|
||||||
// Tips:部分发货状态下的父订单,调此接口发货,会报错:该订单当前为“部分发货”状态,无法调用此接口
|
// Tips:部分发货状态下的父订单,调此接口发货,会报错:该订单当前为“部分发货”状态,无法调用此接口
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import (
|
|||||||
product_getProductUpdateRule_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_getProductUpdateRule/request"
|
product_getProductUpdateRule_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_getProductUpdateRule/request"
|
||||||
product_listV2_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_listV2/request"
|
product_listV2_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_listV2/request"
|
||||||
product_listV2_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_listV2/response"
|
product_listV2_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_listV2/response"
|
||||||
|
product_qualificationConfig_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_qualificationConfig/request"
|
||||||
|
product_qualificationConfig_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_qualificationConfig/response"
|
||||||
product_setOffline_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_setOffline/request"
|
product_setOffline_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_setOffline/request"
|
||||||
shop_getShopCategory_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_getShopCategory/request"
|
shop_getShopCategory_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_getShopCategory/request"
|
||||||
sku_editPrice_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/sku_editPrice/request"
|
sku_editPrice_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/sku_editPrice/request"
|
||||||
@@ -117,10 +119,48 @@ func (a *API) GetCatePropertyV2(categoryLeftId int64) (*product_getCatePropertyV
|
|||||||
|
|
||||||
// CreateStoreCommodity (新增总部商品)
|
// CreateStoreCommodity (新增总部商品)
|
||||||
func (a *API) CreateStoreCommodity(skuParam *product_addV2_request.ProductAddV2Param) (*product_addV2_response.ProductAddV2Data, error) {
|
func (a *API) CreateStoreCommodity(skuParam *product_addV2_request.ProductAddV2Param) (*product_addV2_response.ProductAddV2Data, error) {
|
||||||
|
qualityList := make([]product_addV2_request.QualityListItem, 0, 0)
|
||||||
|
switch a.accessTokenObj.ShopId {
|
||||||
|
case TiktokFloderKeyVegetableKey: // 京西速食
|
||||||
|
qualityList = append(qualityList, product_addV2_request.QualityListItem{
|
||||||
|
QualityKey: QualificationsSuShiPackageId,
|
||||||
|
QualityName: QualificationsSuShiPackageName,
|
||||||
|
QualityAttachments: []product_addV2_request.QualityAttachmentsItem{
|
||||||
|
product_addV2_request.QualityAttachmentsItem{
|
||||||
|
MediaType: 1,
|
||||||
|
Url: QualificationsPackageImg,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
case TiktokFloderKeyShoppingKey: // 京西超市
|
||||||
|
qualityList = append(qualityList, product_addV2_request.QualityListItem{
|
||||||
|
QualityKey: QualificationsShopPackageId,
|
||||||
|
QualityName: QualificationsShopPackageName,
|
||||||
|
QualityAttachments: []product_addV2_request.QualityAttachmentsItem{
|
||||||
|
product_addV2_request.QualityAttachmentsItem{
|
||||||
|
MediaType: 1,
|
||||||
|
Url: QualificationsShopPackageImg,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
case TiktokFloderKeyBeautifulKey: // 美好菜市
|
||||||
|
qualityList = append(qualityList, product_addV2_request.QualityListItem{
|
||||||
|
QualityKey: QualificationsBeautifulPackageId,
|
||||||
|
QualityName: QualificationsBeautifulPackageName,
|
||||||
|
QualityAttachments: []product_addV2_request.QualityAttachmentsItem{
|
||||||
|
product_addV2_request.QualityAttachmentsItem{
|
||||||
|
MediaType: 1,
|
||||||
|
Url: QualificationsBeautifulPackageImg,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
default:
|
||||||
|
return nil, errors.New("创建商品是,资质获取异常")
|
||||||
|
}
|
||||||
|
skuParam.QualityList = qualityList
|
||||||
request := product_addV2_request.New()
|
request := product_addV2_request.New()
|
||||||
request.Param = skuParam
|
request.Param = skuParam
|
||||||
result, err := request.Execute(a.accessTokenObj)
|
result, err := request.Execute(a.accessTokenObj)
|
||||||
globals.SugarLogger.Debugf("================result: %s", utils.Format4Output(result, false))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -130,6 +170,32 @@ func (a *API) CreateStoreCommodity(skuParam *product_addV2_request.ProductAddV2P
|
|||||||
return result.Data, nil
|
return result.Data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *API) QualityList(categoryId int64) ([]*product_qualificationConfig_response.ConfigListItem, error) {
|
||||||
|
if categoryId <= 0 {
|
||||||
|
return nil, errors.New("categoryId 不能为0")
|
||||||
|
}
|
||||||
|
|
||||||
|
request := product_qualificationConfig_request.New()
|
||||||
|
request.Param.CategoryId = categoryId
|
||||||
|
result, err := request.Execute(a.accessTokenObj)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if result.Code != RequestSuccessCode {
|
||||||
|
return nil, errors.New(result.SubMsg)
|
||||||
|
}
|
||||||
|
|
||||||
|
configListRequired := make([]*product_qualificationConfig_response.ConfigListItem, 0)
|
||||||
|
for _, v := range result.Data.ConfigList {
|
||||||
|
if v.IsRequired == false {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
configListRequired = append(configListRequired, &v)
|
||||||
|
}
|
||||||
|
globals.SugarLogger.Debugf("configListRequired=== :%s", utils.Format4Output(configListRequired, false))
|
||||||
|
return configListRequired, nil
|
||||||
|
}
|
||||||
|
|
||||||
// SyncStockBatch 库存批量同步
|
// SyncStockBatch 库存批量同步
|
||||||
func (a *API) SyncStockBatch(param *sku_syncStockBatch_request.SkuSyncStockBatchParam) error {
|
func (a *API) SyncStockBatch(param *sku_syncStockBatch_request.SkuSyncStockBatchParam) error {
|
||||||
request := sku_syncStockBatch_request.New()
|
request := sku_syncStockBatch_request.New()
|
||||||
|
|||||||
@@ -68,3 +68,7 @@ func TestGetSkuBrand(t *testing.T) {
|
|||||||
globals.SugarLogger.Debugf("data ========= %v", data)
|
globals.SugarLogger.Debugf("data ========= %v", data)
|
||||||
globals.SugarLogger.Debugf("data ========= %s", err)
|
globals.SugarLogger.Debugf("data ========= %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestQualityList(t *testing.T) {
|
||||||
|
a.QualityList(33079)
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,12 +12,25 @@ const (
|
|||||||
TiktokFolder3 = "71762017122139835211688" // (方案二测试文件夹)
|
TiktokFolder3 = "71762017122139835211688" // (方案二测试文件夹)
|
||||||
TiktokFolder4 = "72213403043425651541645" // (美好菜市)
|
TiktokFolder4 = "72213403043425651541645" // (美好菜市)
|
||||||
TiktokShoppingFolder = "71802347591117703711619" // (方案二测试文件夹)
|
TiktokShoppingFolder = "71802347591117703711619" // (方案二测试文件夹)
|
||||||
TiktokFloderKeyVegetableKey = 57939570 // (菜市的文件夹id)
|
TiktokFloderKeyVegetableKey = 57939570 // (菜市的文件夹id)速食
|
||||||
TiktokFloderKeyShoppingKey = 68023619 // (商超账号的文件夹id)
|
TiktokFloderKeyShoppingKey = 68023619 // (商超账号的文件夹id)
|
||||||
TiktokFloderKeyTestKey = 63141688 // (测试账号)
|
TiktokFloderKeyTestKey = 63141688 // (测试账号)
|
||||||
TiktokFloderKeyBeautifulKey = 68032645 // (美好菜市)
|
TiktokFloderKeyBeautifulKey = 68032645 // (美好菜市)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
QualificationsSuShiPackageId = "7129700904345125135" // 京西速食包装标签id
|
||||||
|
QualificationsSuShiPackageName = "包装标签图_20220809_104106" // 京西速食包装标签名称
|
||||||
|
QualificationsPackageImg = "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/VqGYBUaL_m_e40ed809c2231a95197db39c86fe70e6_sx_463300_www1040-1034" // 速食包装标签图
|
||||||
|
QualificationsShopPackageId = "7182777418275832098" // 京西超市包装标签id
|
||||||
|
QualificationsShopPackageName = "包装标签图_20220809_104107" // 京西超市包装标签名称
|
||||||
|
QualificationsShopPackageImg = "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/TGUZigMc_m_e40ed809c2231a95197db39c86fe70e6_sx_463300_www1040-1034" // 京西超市包装标签名称
|
||||||
|
QualificationsBeautifulPackageId = "7221409845910470964" // 美好菜市包装标签id
|
||||||
|
QualificationsBeautifulPackageName = "包装标签图_20220809_104106" // 美好菜市包装标签名称
|
||||||
|
QualificationsBeautifulPackageImg = "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/yneNVdDN_m_e40ed809c2231a95197db39c86fe70e6_sx_463300_www1040-1034" // 京西超市包装标签名称
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
// 商品减库存类型
|
// 商品减库存类型
|
||||||
const (
|
const (
|
||||||
SkuReduceTypeReduceMakeOrder = 1 // 拍下减库存
|
SkuReduceTypeReduceMakeOrder = 1 // 拍下减库存
|
||||||
|
|||||||
Reference in New Issue
Block a user