1
This commit is contained in:
@@ -8,17 +8,37 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// 京西速食(蔬菜)
|
||||
var token1 = `{"access_token":"3bgefxbys11j7t4nq1hehos0000yhugi-11","expires_in":1759128050,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市","refresh_token":"33306ycgy51j7t4nq1hehos0000yhugi-12","authority_id":""}`
|
||||
//(抖)京西菜市
|
||||
//var token1 = `{"access_token":"81qzlgabmw1j7t4nq1hehos0000yhugi-11","expires_in":1774781291,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市","refresh_token":"s0a144yh8m1j7t4nq1hehos0000yhugi-12","authority_id":""}`
|
||||
|
||||
// 美好菜市
|
||||
//var token1 = `{"access_token":"9a315a03-c737-4a82-ae52-c9a6ce827007","expires_in":1699490747,"scope":"SCOPE","shop_id":68032645,"shop_name":"美好菜市","refresh_token":"8334c006-5301-4d25-911b-4d8cc7b70ebb","authority_id":""}`
|
||||
//(抖)美好菜市 授权已被关闭,请重新打开授权开关
|
||||
//var token1 = `{"access_token":"45f191d2-3917-4f49-a538-da83733c1d70","expires_in":1723882502,"scope":"SCOPE","shop_id":68032645,"shop_name":"京西果园","refresh_token":"a372e76b-6470-4d9f-a375-3cb53e6e32ab","authority_id":""}`
|
||||
|
||||
// 京西到家
|
||||
//var token1 = `{"access_token":"j9cjqyruu01j7t4nq1hehos00014hzcz-11","expires_in":1739587252,"scope":"SCOPE","shop_id":68023619,"shop_name":"京西到家","refresh_token":"pi0v58amo61j7t4nq1hehos00014hzcz-12","authority_id":""}`
|
||||
//(抖)蕾丝袜 授权已被关闭,请重新打开授权开关
|
||||
//var token1 = `{"access_token":"h57u8famv01j7t4nq1hehos0000i4uwm-11","expires_in":1738376382,"scope":"SCOPE","shop_id":30459766,"shop_name":"蕾丝袜","refresh_token":"lrp6tl651c1j7t4nq1hehos0000i4uwm-12","authority_id":""}`
|
||||
|
||||
//(抖)京西到家 // 授权已被关闭,请重新打开授权开关
|
||||
//var token1 = `{"access_token":"vyj6q0cyg91j7t4nq1hehos00014hzcz-11","expires_in":1770518421,"scope":"SCOPE","shop_id":68023619,"shop_name":"京西到家","refresh_token":"pdxa2609jm1j7t4nq1hehos00014hzcz-12","authority_id":""}`
|
||||
|
||||
//(抖)易购生鲜超市 access_token不存在,请使用最新的access_token访问
|
||||
//var token1 = `{"access_token":"c78874c8-0862-403c-8ddb-c25385221632","expires_in":1711559144,"scope":"SCOPE","shop_id":114868220,"shop_name":"易购生鲜超市","refresh_token":"3604ac64-384b-4ed7-a511-8d4794ff56e7","authority_id":""}`
|
||||
|
||||
//(抖)京西同城配送 app_key和access_token不匹配,请仔细检查
|
||||
//var token1 = `{"access_token":"fb41e4d5-c92f-4b07-956f-46c63d0547be","expires_in":1692275028,"scope":"SCOPE","shop_id":92037439,"shop_name":"京西花园","refresh_token":"5fa3efc3-d3c4-410a-baaa-0fb23d408ccf","authority_id":""}`
|
||||
|
||||
// 测试门店
|
||||
var token1 = `{"access_token":"syriovzwwq1j7t4nq1hehos0004b2xdw-11","expires_in":1774425349,"scope":"SCOPE","shop_id":260477060,"shop_name":"开放平台测试专用店4","refresh_token":"8u762h27341j7t4nq1hehos0004b2xdw-12","authority_id":""}`
|
||||
|
||||
var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token1)
|
||||
|
||||
func TestCategory(t *testing.T) {
|
||||
data, err := a.GetShopCategory(0)
|
||||
for _, v := range data {
|
||||
fmt.Println(v.Id, "---", v.Name, "---", v.IsLeaf, "---", v.Level)
|
||||
}
|
||||
fmt.Println("data====", err)
|
||||
}
|
||||
|
||||
// 查询售后单详情
|
||||
func TestAfsOrder(t *testing.T) {
|
||||
data, err := a.QueryAfsOrderDetail("146453779045950796", false)
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
product_addV2_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_addV2/response"
|
||||
product_auditList_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_auditList/request"
|
||||
product_auditList_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_auditList/response"
|
||||
product_batchGetChannelCategoryMapping_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_batchGetChannelCategoryMapping/request"
|
||||
product_del_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_del/request"
|
||||
product_detail_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_detail/request"
|
||||
product_detail_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_detail/response"
|
||||
@@ -66,9 +67,11 @@ func (a *API) UpdateSkuStock(param *sku_syncStock_request.SkuSyncStockParam) err
|
||||
// 3、循环获取最小层级类目id方式:再判断is_leaf=true或false。is_leaf=true表示是叶子节点,最小层级类目id。is_leaf=false表示不是子节点,请求参数cid=上一次响应参数id,直到获取最小层级类目id。
|
||||
func (a *API) GetShopCategory(cid int64) ([]*RetailCategoryInfo, error) {
|
||||
// 如果cid为0,则获取所有的分类,如果cid不为0,则获取该分类下面的所有子分类
|
||||
channel := int32(1) // 0获取老的分类ID 1获取最新的分类id
|
||||
request := shop_getShopCategory_request.New()
|
||||
param := request.GetParams()
|
||||
param.Cid = cid
|
||||
param.Channel = &channel
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -117,18 +120,43 @@ func (a *API) GetCatePropertyV2(categoryLeftId int64) (*product_getCatePropertyV
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// BatchGetChannelCategoryMapping 根据旧的抖音分类获取新的分类
|
||||
func (a *API) BatchGetChannelCategoryMapping(categoryIds []int64) (map[int64]int64, error) {
|
||||
request := product_batchGetChannelCategoryMapping_request.New()
|
||||
param := request.GetParams()
|
||||
categoryList := make([]product_batchGetChannelCategoryMapping_request.ReqItemsItem, 0, len(categoryIds))
|
||||
for _, v := range categoryIds {
|
||||
categoryList = append(categoryList, product_batchGetChannelCategoryMapping_request.ReqItemsItem{
|
||||
CategoryId: utils.Int64ToPointer(v),
|
||||
})
|
||||
}
|
||||
param.ReqItems = categoryList
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if result.Code != RequestSuccessCode {
|
||||
return nil, errors.New(result.SubMsg + ":" + result.LogId)
|
||||
}
|
||||
|
||||
mappingData := make(map[int64]int64, 0)
|
||||
for _, v := range result.Data.RespItems {
|
||||
mappingData[v.SourceCategoryId] = v.CategoryMappings[0].MappingCategoryId
|
||||
}
|
||||
|
||||
return mappingData, nil
|
||||
}
|
||||
|
||||
// CreateStoreCommodity (新增总部商品)
|
||||
func (a *API) CreateStoreCommodity(skuParam *product_addV2_request.ProductAddV2Param) (*product_addV2_response.ProductAddV2Data, error) {
|
||||
skuParam.AfterSaleServiceV2 = &product_addV2_request.AfterSaleServiceV2{
|
||||
ThreeGuarantees: struct {
|
||||
Duration int64 `json:"duration"`
|
||||
ServiceType int64 `json:"service_type"`
|
||||
}{
|
||||
Duration: 7,
|
||||
ServiceType: 1,
|
||||
},
|
||||
IsLargeProduct: 0,
|
||||
}
|
||||
//skuParam.AfterSaleServiceV2 = &product_addV2_request.AfterSaleServiceV2{
|
||||
// IsLargeProduct: utils.Int64ToPointer(0),
|
||||
// ThreeGuarantees: &product_addV2_request.ThreeGuarantees{
|
||||
// Duration: utils.Int64ToPointer(7),
|
||||
// ServiceType: utils.Int64ToPointer(1),
|
||||
// },
|
||||
//}
|
||||
qualityList := make([]product_addV2_request.QualityListItem, 0, 0)
|
||||
switch a.accessTokenObj.ShopId {
|
||||
case TiktokFloderKeyVegetableKey: // 京西速食
|
||||
@@ -164,8 +192,19 @@ func (a *API) CreateStoreCommodity(skuParam *product_addV2_request.ProductAddV2P
|
||||
},
|
||||
},
|
||||
})
|
||||
case 260477060:
|
||||
qualityList = append(qualityList, product_addV2_request.QualityListItem{
|
||||
QualityKey: "6966228537426575660",
|
||||
QualityName: "包装标签图",
|
||||
QualityAttachments: []product_addV2_request.QualityAttachmentsItem{
|
||||
product_addV2_request.QualityAttachmentsItem{
|
||||
MediaType: 1,
|
||||
Url: "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/jpeg_m_94ab77cb6e8b8812abac65f89640e6b9_sx_466038_www1000-1000",
|
||||
},
|
||||
},
|
||||
})
|
||||
default:
|
||||
return nil, errors.New("创建商品是,资质获取异常")
|
||||
//return nil, errors.New("创建商品是,资质获取异常")
|
||||
}
|
||||
skuParam.QualityList = qualityList
|
||||
request := product_addV2_request.New()
|
||||
@@ -180,6 +219,7 @@ func (a *API) CreateStoreCommodity(skuParam *product_addV2_request.ProductAddV2P
|
||||
return result.Data, nil
|
||||
}
|
||||
|
||||
// QualityList 商品资质查询
|
||||
func (a *API) QualityList(categoryId int64) ([]*product_qualificationConfig_response.ConfigListItem, error) {
|
||||
if categoryId <= 0 {
|
||||
return nil, errors.New("categoryId 不能为0")
|
||||
@@ -253,7 +293,8 @@ func (a *API) EditStoreCommodityCommit(sku *product_editV2_commit_request.Produc
|
||||
func (a *API) DeleteStoreCommodity(productId int64) error {
|
||||
request := product_del_request.New()
|
||||
param := request.GetParams()
|
||||
param.ProductId = productId
|
||||
//param.ProductId = productId
|
||||
param.OutProductId = 6119735
|
||||
param.DeleteForever = true
|
||||
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
@@ -369,8 +410,8 @@ func (a *API) EditPrice(skuPrice *sku_editPrice_request.SkuEditPriceParam) error
|
||||
// GetSkuBrand 获取商品所属品牌
|
||||
func (a *API) GetSkuBrand(categoryId int64, brandName string) (int64, error) {
|
||||
request := brand_list_request.New()
|
||||
request.Param.CategoryId = categoryId
|
||||
request.Param.Query = brandName
|
||||
request.Param.CategoryId = utils.Int64ToPointer(categoryId)
|
||||
request.Param.Query = utils.String2Pointer(brandName)
|
||||
result, err := request.Execute(a.accessTokenObj)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
@@ -601,36 +642,22 @@ func (a *API) GetRecommendCategoryByName(name string) (int64, error) {
|
||||
return 0, errors.New("抖音根据图片获取分类,返回值为0")
|
||||
}
|
||||
|
||||
var firstCid int64
|
||||
var secondCid int64
|
||||
var thirdCid int64
|
||||
var fourthCid int64
|
||||
if len(result.Data.CategoryDetails) == 0 {
|
||||
return 0, errors.New("抖音根据名称获取分类,返回值为0")
|
||||
}
|
||||
categoryDetail := result.Data.CategoryDetails[0].CategoryDetail
|
||||
cids := []int64{
|
||||
categoryDetail.FourthCid,
|
||||
categoryDetail.ThirdCid,
|
||||
categoryDetail.SecondCid,
|
||||
categoryDetail.FirstCid,
|
||||
}
|
||||
for _, cid := range cids {
|
||||
if cid != 0 {
|
||||
return cid, nil
|
||||
}
|
||||
}
|
||||
|
||||
index := len(result.Data.CategoryDetails) - 1
|
||||
if result.Data.CategoryDetails[index].CategoryDetail.FirstCid != 0 {
|
||||
firstCid = result.Data.CategoryDetails[index].CategoryDetail.FirstCid
|
||||
}
|
||||
if result.Data.CategoryDetails[index].CategoryDetail.SecondCid != 0 {
|
||||
secondCid = result.Data.CategoryDetails[index].CategoryDetail.SecondCid
|
||||
}
|
||||
if result.Data.CategoryDetails[index].CategoryDetail.ThirdCid != 0 {
|
||||
thirdCid = result.Data.CategoryDetails[index].CategoryDetail.ThirdCid
|
||||
}
|
||||
if result.Data.CategoryDetails[index].CategoryDetail.FourthCid != 0 {
|
||||
fourthCid = result.Data.CategoryDetails[index].CategoryDetail.FourthCid
|
||||
}
|
||||
if fourthCid != 0 {
|
||||
return fourthCid, nil
|
||||
}
|
||||
if thirdCid != 0 {
|
||||
return thirdCid, nil
|
||||
}
|
||||
if secondCid != 0 {
|
||||
return secondCid, nil
|
||||
}
|
||||
if firstCid != 0 {
|
||||
return firstCid, nil
|
||||
}
|
||||
return 0, errors.New("抖音获取推荐分类异常")
|
||||
}
|
||||
|
||||
@@ -640,7 +667,7 @@ func (a *API) GetRecommendCategory(picParams []string) (int64, error) {
|
||||
return 0, errors.New("抖音根据图片预测分类,图片不能为空")
|
||||
}
|
||||
request := product_GetRecommendCategory_request.New()
|
||||
request.Param.Scene = "smart_publish" // 根据图片获取分类属性
|
||||
request.Param.Scene = "predict_by_title_and_img" // 根据图片获取分类属性
|
||||
picList := make([]product_GetRecommendCategory_request.PicItem, 0, 0)
|
||||
for _, v := range picParams {
|
||||
picList = append(picList, product_GetRecommendCategory_request.PicItem{Url: v})
|
||||
@@ -658,36 +685,19 @@ func (a *API) GetRecommendCategory(picParams []string) (int64, error) {
|
||||
if len(result.Data.CategoryDetails) == 0 {
|
||||
return 0, errors.New("抖音根据图片获取分类,返回值为0")
|
||||
}
|
||||
categoryDetail := result.Data.CategoryDetails[0].CategoryDetail
|
||||
cids := []int64{
|
||||
categoryDetail.FourthCid,
|
||||
categoryDetail.ThirdCid,
|
||||
categoryDetail.SecondCid,
|
||||
categoryDetail.FirstCid,
|
||||
}
|
||||
for _, cid := range cids {
|
||||
if cid != 0 {
|
||||
return cid, nil
|
||||
}
|
||||
}
|
||||
|
||||
var firstCid int64
|
||||
var secondCid int64
|
||||
var thirdCid int64
|
||||
var fourthCid int64
|
||||
|
||||
if result.Data.CategoryDetails[0].CategoryDetail.FirstCid != 0 {
|
||||
firstCid = result.Data.CategoryDetails[0].CategoryDetail.FirstCid
|
||||
}
|
||||
if result.Data.CategoryDetails[0].CategoryDetail.SecondCid != 0 {
|
||||
secondCid = result.Data.CategoryDetails[0].CategoryDetail.SecondCid
|
||||
}
|
||||
if result.Data.CategoryDetails[0].CategoryDetail.ThirdCid != 0 {
|
||||
thirdCid = result.Data.CategoryDetails[0].CategoryDetail.ThirdCid
|
||||
}
|
||||
if result.Data.CategoryDetails[0].CategoryDetail.FourthCid != 0 {
|
||||
fourthCid = result.Data.CategoryDetails[0].CategoryDetail.FourthCid
|
||||
}
|
||||
if fourthCid != 0 {
|
||||
return fourthCid, nil
|
||||
}
|
||||
if thirdCid != 0 {
|
||||
return thirdCid, nil
|
||||
}
|
||||
if secondCid != 0 {
|
||||
return secondCid, nil
|
||||
}
|
||||
if firstCid != 0 {
|
||||
return firstCid, nil
|
||||
}
|
||||
return 0, errors.New("抖音获取推荐分类异常")
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,13 @@ package tiktok_api
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi"
|
||||
product_editV2_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_editV2/request"
|
||||
product_addV2_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_addV2/request"
|
||||
product_editV2_commit_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_editV2_commit/request"
|
||||
product_listV2_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_listV2/request"
|
||||
sku_editPrice_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/sku_editPrice/request"
|
||||
sku_syncStock_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/sku_syncStock/request"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"go.uber.org/zap"
|
||||
"strings"
|
||||
@@ -26,19 +27,144 @@ func TestCreateSubProduct(t *testing.T) {
|
||||
a.CreateSubProduct(3592508194611683124, 64251631)
|
||||
}
|
||||
|
||||
func TestCategory(t *testing.T) {
|
||||
data, err := a.GetShopCategory(20314)
|
||||
for _, v := range data {
|
||||
fmt.Println(v.Id, "---", v.Name, "---", v.IsLeaf, "---", v.Level)
|
||||
func TestGetRecommendCategoryByName(t *testing.T) {
|
||||
a.GetRecommendCategoryByName("红富士苹果")
|
||||
}
|
||||
|
||||
func TestBatchGetChannelCategoryMapping(t *testing.T) {
|
||||
items, err := a.BatchGetChannelCategoryMapping(nil)
|
||||
globals.SugarLogger.Debugf("-items:= %s", utils.Format4Output(items, false))
|
||||
globals.SugarLogger.Debugf("-items:= %v", err)
|
||||
}
|
||||
|
||||
func TestCreateStoreCommodity(t *testing.T) {
|
||||
//PayType := int64(1)
|
||||
//weight := float64(300)
|
||||
param := &product_addV2_request.ProductAddV2Param{
|
||||
//OuterProductId: utils.String2Pointer("6119735"),
|
||||
//ProductType: 0,
|
||||
//CategoryLeafId: 1000006281,
|
||||
//Name: "[同城配送]过水猪耳朵1个",
|
||||
RecommendRemark: nil,
|
||||
//Pic: "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/png_m_c3009881689e4115f65344a3f230ac23_sx_535006_www800-800",
|
||||
//Description: "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/png_m_0b96110a31122b380d0bb2f9bbacc8a7_sx_705423_www800-800",
|
||||
//PayType: &PayType,
|
||||
DeliveryMethod: nil,
|
||||
CdfCategory: nil,
|
||||
//ReduceType: 1,
|
||||
AssocIds: nil,
|
||||
//FreightId: 0,
|
||||
//Weight: &weight,
|
||||
//WeightUnit: &PayType,
|
||||
//DeliveryDelayDay: utils.Int64ToPointer(9999),
|
||||
//PresellType: utils.Int64ToPointer(0),
|
||||
PresellDelay: nil,
|
||||
PresellEndTime: nil,
|
||||
Supply7dayReturn: nil,
|
||||
//Mobile: "18981810340",
|
||||
//Commit: true,
|
||||
Remark: nil,
|
||||
OutProductId: nil,
|
||||
QualityList: nil,
|
||||
SpecName: nil,
|
||||
//Specs: utils.String2Pointer("总净重|300g"),
|
||||
//SpecPrices: utils.String2Pointer("[{\"spec_detail_name1\":\"300g\",\"spec_detail_name2\":\"\",\"spec_detail_name3\":\"\",\"stock_num\":999999,\"price\":2500,\"code\":\"6119735\",\"step_stock_num\":0,\"supplier_id\":\"\",\"outer_sku_id\":\"6119735\",\"sku_type\":1,\"stock_num_map\":{\"260477060\":999999},\"delivery_infos\":[{\"info_type\":\"weight\",\"info_value\":\"300\",\"info_unit\":\"g\"}]}]"),
|
||||
SpecPic: nil,
|
||||
MaximumPerOrder: utils.Int64ToPointer(50),
|
||||
LimitPerBuyer: utils.Int64ToPointer(200),
|
||||
MinimumPerOrder: nil,
|
||||
//ProductFormatNew: utils.String2Pointer("{\"1687\": [{\"diy_type\": 0,\"name\": \"品牌\",\"value\": 596120136}]}"),
|
||||
SpuId: nil,
|
||||
AppointDeliveryDay: nil,
|
||||
ThirdUrl: nil,
|
||||
Extra: nil,
|
||||
Src: nil,
|
||||
//StandardBrandId: utils.Int64ToPointer(596120136),
|
||||
NeedCheckOut: nil,
|
||||
PoiResource: nil,
|
||||
CarVinCode: nil,
|
||||
PresellConfigLevel: nil,
|
||||
//NeedRechargeMode: nil,
|
||||
AccountTemplateId: nil,
|
||||
PresellDeliveryType: nil,
|
||||
//WhiteBackGroundPicUrl: utils.String2Pointer("https://p3-aio.ecombdimg.com/obj/ecom-shop-material/png_m_c3009881689e4115f65344a3f230ac23_sx_535006_www800-800"),
|
||||
LongPicUrl: nil,
|
||||
//AfterSaleService: &map[string]string{"supply_day_return_selector": "7-0"},
|
||||
SellChannel: nil,
|
||||
//StartSaleType: utils.Int64ToPointer(0),
|
||||
DelayRule: nil,
|
||||
MaterialVideoId: nil,
|
||||
//PickupMethod: utils.String2Pointer("0"),
|
||||
SizeInfoTemplateId: nil,
|
||||
SubstituteGoodsUrl: nil,
|
||||
SaleChannelType: nil,
|
||||
RecruitInfo: nil,
|
||||
StoreId: nil,
|
||||
MainProductId: nil,
|
||||
//SaleLimitId: nil,
|
||||
NamePrefix: nil,
|
||||
ReferencePrice: nil,
|
||||
ReferencePriceCertificate: nil,
|
||||
MainImageThreeToFour: nil,
|
||||
UnitPriceInfo: nil,
|
||||
QualityInspectionInfo: nil,
|
||||
IsC2bSwitchOn: nil,
|
||||
MicroAppId: nil,
|
||||
IsAutoCharge: nil,
|
||||
ShortProductName: nil,
|
||||
AfterSaleServiceV2: nil,
|
||||
SpecInfo: nil,
|
||||
SpecPricesV2: nil,
|
||||
WithSkuType: nil,
|
||||
NameSuffix: nil,
|
||||
UseBrandName: nil,
|
||||
OpenLogisticsInfo: nil,
|
||||
PriceHasTax: nil,
|
||||
BizKind: nil,
|
||||
CustomProperty: nil,
|
||||
IsEvaluateOpened: nil,
|
||||
DefaultProcessTime: nil,
|
||||
CompanyId: nil,
|
||||
IsSecondHandDigital: nil,
|
||||
RecommendIds: &map[string]string{"key": "2026031817465122DCADE158861CDE62EC_17cf3282b23449a"},
|
||||
ShowCheckoutEntry: nil,
|
||||
PickupPrepareTime: nil,
|
||||
HomeInstallServiceTemplateId: nil,
|
||||
CategoryPropertyPics: nil,
|
||||
}
|
||||
fmt.Println("data====", err)
|
||||
a.CreateStoreCommodity(param)
|
||||
}
|
||||
|
||||
func TestGetCatePropertyV2(t *testing.T) {
|
||||
data, err := a.GetCatePropertyV2(33622)
|
||||
fmt.Println("err=====", err)
|
||||
globals.SugarLogger.Debugf("data:=%s", utils.Format4Output(data, false))
|
||||
fmt.Println("data====", data) // 202209281558450102081001701D7B32C5
|
||||
categoryList, err := a.GetCatePropertyV2(1000002049)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
categoryMap := make(map[string][]map[string]interface{})
|
||||
for _, v := range categoryList.Data.Data {
|
||||
if v.Required != model.YES {
|
||||
continue
|
||||
}
|
||||
options := make([]map[string]interface{}, 0)
|
||||
if v.PropertyName == "品牌" {
|
||||
options = append(options, map[string]interface{}{"name": v.PropertyName, "value": 596120136, "diy_type": v.DiyType})
|
||||
categoryMap[utils.Int64ToStr(v.PropertyId)] = options
|
||||
} else if v.PropertyName == "产地" {
|
||||
options = append(options, map[string]interface{}{"name": v.PropertyName, "value": 13850, "diy_type": v.DiyType})
|
||||
categoryMap[utils.Int64ToStr(v.PropertyId)] = options
|
||||
} else if v.PropertyName == "生鲜储存温度" {
|
||||
options = append(options, map[string]interface{}{"name": v.PropertyName, "value": 2808, "diy_type": v.DiyType})
|
||||
categoryMap[utils.Int64ToStr(v.PropertyId)] = options
|
||||
} else if len(v.Options) == 0 {
|
||||
options = append(options, map[string]interface{}{"name": v.PropertyName, "value": 0, "diy_type": v.DiyType})
|
||||
categoryMap[utils.Int64ToStr(v.PropertyId)] = options
|
||||
} else {
|
||||
options = append(options, map[string]interface{}{"name": v.PropertyName, "value": utils.Str2Int64(v.Options[0].Value), "diy_type": v.DiyType})
|
||||
categoryMap[utils.Int64ToStr(v.PropertyId)] = options
|
||||
}
|
||||
}
|
||||
productFormatNew := utils.Format4Output(categoryMap, false)
|
||||
fmt.Println(productFormatNew)
|
||||
}
|
||||
|
||||
func TestInt16(t *testing.T) {
|
||||
@@ -79,78 +205,78 @@ func TestEiduPrice(t *testing.T) {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
// s上架1
|
||||
func TestEditStoreCommodity(t *testing.T) {
|
||||
a.GetProductUpdateRule(32241)
|
||||
err := a.EditStoreCommodity(&product_editV2_request.ProductEditV2Param{
|
||||
ProductId: 3605562143317059130,
|
||||
ProductType: 0,
|
||||
CategoryLeafId: 32241,
|
||||
ProductFormat: "",
|
||||
Name: "三线肉约500g/份【同城配送】",
|
||||
RecommendRemark: "",
|
||||
Pic: "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/VqGYBUaL_m_4bf295c4d3b6466138c5650a4d433935_sx_504060_www800-800",
|
||||
Description: "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/VqGYBUaL_m_2e3b9a6bbf7649895bff131393b42b4c_sx_463917_www750-3527",
|
||||
PayType: 1,
|
||||
DeliveryMethod: 0,
|
||||
CdfCategory: "",
|
||||
ReduceType: 2,
|
||||
AssocIds: "",
|
||||
FreightId: 0,
|
||||
Weight: 500,
|
||||
WeightUnit: 1,
|
||||
DeliveryDelayDay: 9999,
|
||||
PresellType: 0,
|
||||
PresellDelay: 0,
|
||||
PresellEndTime: "",
|
||||
Supply7dayReturn: 0,
|
||||
Mobile: "18598908808",
|
||||
Commit: true,
|
||||
BrandId: 0,
|
||||
Remark: "",
|
||||
//OutProductId: 0,
|
||||
QualityList: nil,
|
||||
SpecName: "",
|
||||
Specs: "重量|500g",
|
||||
SpecPrices: "[{\"spec_detail_name1\":\"500g\",\"spec_detail_name2\":\"\",\"spec_detail_name3\":\"\",\"stock_num\":999999,\"price\":3500,\"code\":\"22700\",\"step_stock_num\":0,\"supplier_id\":\"\",\"outer_sku_id\":\"70122700701\",\"sku_type\":1,\"stock_num_map\":{\"173965249\":999999},\"delivery_infos\":[{\"info_type\":\"weight\",\"info_value\":\"500\",\"info_unit\":\"g\"}]}]",
|
||||
SpecPic: "",
|
||||
MaximumPerOrder: 0,
|
||||
LimitPerBuyer: 0,
|
||||
MinimumPerOrder: 0,
|
||||
ProductFormatNew: "{\n\t\"1687\": [\n\t\t{\n\t\t\t\"diy_type\": 0,\n\t\t\t\"name\": \"品牌\",\n\t\t\t\"value\": 596120136\n\t\t}\n\t],\n\t\"1758\": [\n\t\t{\n\t\t\t\"diy_type\": 1,\n\t\t\t\"name\": \"包装方式\",\n\t\t\t\"value\": 8197\n\t\t}\n\t],\n\t\"1880\": [\n\t\t{\n\t\t\t\"diy_type\": 0,\n\t\t\t\"name\": \"产地\",\n\t\t\t\"value\": 13850\n\t\t}\n\t],\n\t\"2130\": [\n\t\t{\n\t\t\t\"diy_type\": 0,\n\t\t\t\"name\": \"生鲜储存温度\",\n\t\t\t\"value\": 2808\n\t\t}\n\t]\n}",
|
||||
SpuId: 0,
|
||||
AppointDeliveryDay: 0,
|
||||
ThirdUrl: "",
|
||||
Extra: "",
|
||||
Src: "",
|
||||
//OuterProductId: "",
|
||||
StandardBrandId: 596120136,
|
||||
NeedCheckOut: false,
|
||||
PoiResource: nil,
|
||||
ForceUseQualityList: false,
|
||||
CarVinCode: "",
|
||||
PresellConfigLevel: 0,
|
||||
NeedRechargeMode: false,
|
||||
PresellDeliveryType: 0,
|
||||
WhiteBackGroundPicUrl: "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/VqGYBUaL_m_4bf295c4d3b6466138c5650a4d433935_sx_504060_www800-800",
|
||||
LongPicUrl: "",
|
||||
AfterSaleService: map[string]string{
|
||||
"supply_day_return_selector": "7-0",
|
||||
},
|
||||
SellChannel: []int64{0},
|
||||
DelayRule: nil,
|
||||
MaterialVideoId: "",
|
||||
PickupMethod: "0",
|
||||
SizeInfoTemplateId: 0,
|
||||
SubstituteGoodsUrl: "",
|
||||
SaleChannelType: "",
|
||||
NamePrefix: "",
|
||||
StoreId: 0,
|
||||
MainProductId: 0,
|
||||
SaleLimitId: 0,
|
||||
})
|
||||
t.Fatal(err)
|
||||
}
|
||||
//// s上架1
|
||||
//func TestEditStoreCommodity(t *testing.T) {
|
||||
// a.GetProductUpdateRule(32241)
|
||||
// err := a.EditStoreCommodity(&product_editV2_request.ProductEditV2Param{
|
||||
// ProductId: 3605562143317059130,
|
||||
// ProductType: 0,
|
||||
// CategoryLeafId: 32241,
|
||||
// ProductFormat: "",
|
||||
// Name: "三线肉约500g/份【同城配送】",
|
||||
// RecommendRemark: "",
|
||||
// Pic: "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/VqGYBUaL_m_4bf295c4d3b6466138c5650a4d433935_sx_504060_www800-800",
|
||||
// Description: "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/VqGYBUaL_m_2e3b9a6bbf7649895bff131393b42b4c_sx_463917_www750-3527",
|
||||
// PayType: 1,
|
||||
// DeliveryMethod: 0,
|
||||
// CdfCategory: "",
|
||||
// ReduceType: 2,
|
||||
// AssocIds: "",
|
||||
// FreightId: 0,
|
||||
// Weight: 500,
|
||||
// WeightUnit: 1,
|
||||
// DeliveryDelayDay: 9999,
|
||||
// PresellType: 0,
|
||||
// PresellDelay: 0,
|
||||
// PresellEndTime: "",
|
||||
// Supply7dayReturn: 0,
|
||||
// Mobile: "18598908808",
|
||||
// Commit: true,
|
||||
// BrandId: 0,
|
||||
// Remark: "",
|
||||
// //OutProductId: 0,
|
||||
// QualityList: nil,
|
||||
// SpecName: "",
|
||||
// Specs: "重量|500g",
|
||||
// SpecPrices: "[{\"spec_detail_name1\":\"500g\",\"spec_detail_name2\":\"\",\"spec_detail_name3\":\"\",\"stock_num\":999999,\"price\":3500,\"code\":\"22700\",\"step_stock_num\":0,\"supplier_id\":\"\",\"outer_sku_id\":\"70122700701\",\"sku_type\":1,\"stock_num_map\":{\"173965249\":999999},\"delivery_infos\":[{\"info_type\":\"weight\",\"info_value\":\"500\",\"info_unit\":\"g\"}]}]",
|
||||
// SpecPic: "",
|
||||
// MaximumPerOrder: 0,
|
||||
// LimitPerBuyer: 0,
|
||||
// MinimumPerOrder: 0,
|
||||
// ProductFormatNew: "{\n\t\"1687\": [\n\t\t{\n\t\t\t\"diy_type\": 0,\n\t\t\t\"name\": \"品牌\",\n\t\t\t\"value\": 596120136\n\t\t}\n\t],\n\t\"1758\": [\n\t\t{\n\t\t\t\"diy_type\": 1,\n\t\t\t\"name\": \"包装方式\",\n\t\t\t\"value\": 8197\n\t\t}\n\t],\n\t\"1880\": [\n\t\t{\n\t\t\t\"diy_type\": 0,\n\t\t\t\"name\": \"产地\",\n\t\t\t\"value\": 13850\n\t\t}\n\t],\n\t\"2130\": [\n\t\t{\n\t\t\t\"diy_type\": 0,\n\t\t\t\"name\": \"生鲜储存温度\",\n\t\t\t\"value\": 2808\n\t\t}\n\t]\n}",
|
||||
// SpuId: 0,
|
||||
// AppointDeliveryDay: 0,
|
||||
// ThirdUrl: "",
|
||||
// Extra: "",
|
||||
// Src: "",
|
||||
// //OuterProductId: "",
|
||||
// StandardBrandId: 596120136,
|
||||
// NeedCheckOut: false,
|
||||
// PoiResource: nil,
|
||||
// ForceUseQualityList: false,
|
||||
// CarVinCode: "",
|
||||
// PresellConfigLevel: 0,
|
||||
// NeedRechargeMode: false,
|
||||
// PresellDeliveryType: 0,
|
||||
// WhiteBackGroundPicUrl: "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/VqGYBUaL_m_4bf295c4d3b6466138c5650a4d433935_sx_504060_www800-800",
|
||||
// LongPicUrl: "",
|
||||
// AfterSaleService: map[string]string{
|
||||
// "supply_day_return_selector": "7-0",
|
||||
// },
|
||||
// SellChannel: []int64{0},
|
||||
// DelayRule: nil,
|
||||
// MaterialVideoId: "",
|
||||
// PickupMethod: "0",
|
||||
// SizeInfoTemplateId: 0,
|
||||
// SubstituteGoodsUrl: "",
|
||||
// SaleChannelType: "",
|
||||
// NamePrefix: "",
|
||||
// StoreId: 0,
|
||||
// MainProductId: 0,
|
||||
// SaleLimitId: 0,
|
||||
// })
|
||||
// t.Fatal(err)
|
||||
//}
|
||||
|
||||
// 上架2
|
||||
func TestEditStoreCommodity2(t *testing.T) {
|
||||
@@ -223,8 +349,8 @@ func TestDeleteSkuAndUploadSkuFengJinBiXu222(t *testing.T) {
|
||||
Status: 0,
|
||||
CheckStatus: 3, // 1-未提交;2-待审核;3-审核通过;4-审核未通过;5-封禁;7-审核通过待上架
|
||||
Page: int64(i),
|
||||
Size: 1,
|
||||
StoreId: 152631194,
|
||||
Size: 10,
|
||||
StoreId: 255085124,
|
||||
})
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debugf("=index := %d ,err := %s", i, utils.Format4Output(err, false))
|
||||
@@ -278,6 +404,9 @@ func TestDeleteSkuAndUploadSku55(t *testing.T) {
|
||||
globals.SugarLogger.Debugf("err := %s", utils.Format4Output(v, false))
|
||||
}
|
||||
}
|
||||
func TestDelete(t *testing.T) {
|
||||
a.DeleteStoreCommodity(3809577644748571000)
|
||||
}
|
||||
|
||||
// 删除已经创建商品,重新同步
|
||||
func TestDeleteSkuAndUploadSku7(t *testing.T) {
|
||||
|
||||
@@ -57,6 +57,8 @@ func (a *API) BatchUploadImages(imgs []Imgs) (map[string]material_batchUploadIma
|
||||
img.FolderId = TiktokFolder1
|
||||
case TiktokFloderKeyBeautifulKey:
|
||||
img.FolderId = TiktokFolder4
|
||||
case 260477060:
|
||||
img.FolderId = "0"
|
||||
}
|
||||
param = append(param, img)
|
||||
}
|
||||
|
||||
@@ -44,9 +44,12 @@ func TestUploadImg(t *testing.T) {
|
||||
//fmt.Println(err)
|
||||
//fmt.Println(data)
|
||||
//// logid 202209281425150101351501360B6DB460
|
||||
detail := "http://image.jxc4.com/image/a683f420e42e7f377998794cc3838114.jpg"
|
||||
ImgOrigin := "http://image.jxc4.com/image/155162a672092721088cc26b88178886.png"
|
||||
GetTiktokImgList(a, "668619", "", detail, ImgOrigin)
|
||||
detail := "https://image.jxc4.com/image/af51596be83bee4ca9dd71d0a6380b38.jpg"
|
||||
ImgOrigin := "https://image.jxc4.com/image/f7b0b4c6e13eadbf7852110dee602f39.png"
|
||||
img1, img2, err := GetTiktokImgList(a, "668619", "", detail, ImgOrigin)
|
||||
fmt.Println(img1)
|
||||
fmt.Println(img2)
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
// GetTiktokImgList 获取抖音图片链接
|
||||
|
||||
@@ -95,7 +95,7 @@ func TestGetStoreList2(t *testing.T) {
|
||||
//获取门店详细信息
|
||||
func TestGetStoreDetail(t *testing.T) {
|
||||
data, err := a.GetStoreDetail(&shop_getStoreDetail_request.ShopGetStoreDetailParam{
|
||||
StoreId: "209723410",
|
||||
StoreId: "255085124",
|
||||
})
|
||||
if len(data.StoreDetail.Store.OpenTime.DayMap) != 0 {
|
||||
globals.SugarLogger.Debugf("-------data := %s", utils.Format4Output(data.StoreDetail.Store.OpenTime.DayMap, false))
|
||||
|
||||
Reference in New Issue
Block a user