1
This commit is contained in:
@@ -571,29 +571,29 @@ func BatchInitSkuMT2TT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, fromS
|
||||
if copyMap[storeSku.AppFoodCode] == nil || copyMap[storeSku.AppFoodCode].MainSkuId == "" {
|
||||
param := &product_addV2_request.ProductAddV2Param{
|
||||
Name: utils.LimitUTF8StringLen(storeSku.Name, 90),
|
||||
PayType: tiktok_api.TiktokPayType1,
|
||||
PayType: utils.Int64ToPointer(tiktok_api.TiktokPayType1),
|
||||
ReduceType: tiktok_api.SkuReduceTypePayMakeOrder,
|
||||
DeliveryDelayDay: tiktok_api.DeliveryDelayDayToDay,
|
||||
PresellType: tiktok_api.SendGoodsTypeNow,
|
||||
Supply7dayReturn: 0, // 是否支持7天无理由,0不支持,1支持,2支持(拆封后不支持)
|
||||
DeliveryDelayDay: utils.Int64ToPointer(tiktok_api.DeliveryDelayDayToDay),
|
||||
PresellType: utils.Int64ToPointer(tiktok_api.SendGoodsTypeNow),
|
||||
Supply7dayReturn: utils.Int64ToPointer(0), // 是否支持7天无理由,0不支持,1支持,2支持(拆封后不支持)
|
||||
Mobile: toStoreDetail.Tel1,
|
||||
Commit: true,
|
||||
//Specs: "重量|" + utils.Float64ToStr(float64(storeSku.SpecQuality)) + storeSku.SpecUnit,
|
||||
NeedRechargeMode: false,
|
||||
NeedRechargeMode: nil,
|
||||
SellChannel: []int64{0},
|
||||
StartSaleType: 0,
|
||||
PickupMethod: "0",
|
||||
OuterProductId: storeSku.AppFoodCode, // 本地skuId为外部商品id
|
||||
StartSaleType: utils.Int64ToPointer(0),
|
||||
PickupMethod: utils.String2Pointer("0"),
|
||||
OuterProductId: utils.String2Pointer(storeSku.AppFoodCode), // 本地skuId为外部商品id
|
||||
}
|
||||
specs := "重量|"
|
||||
specsList := make([]string, 0, 0)
|
||||
upc := ""
|
||||
for _, sl := range storeSku.SkuList {
|
||||
specsList = append(specsList, strings.Split(sl.Spec, "*")[0])
|
||||
param.Weight = utils.Str2Float64(sl.Weight)
|
||||
param.Weight = utils.Float64ToPointer(utils.Str2Float64(sl.Weight))
|
||||
upc = sl.Upc
|
||||
}
|
||||
param.Specs = specs + strings.Join(specsList, ",")
|
||||
param.Specs = utils.String2Pointer(specs + strings.Join(specsList, ","))
|
||||
// 获取上传图,商品轮播图
|
||||
imgs := make([]tiktok_api.Imgs, 0, 0)
|
||||
for spk, spl := range storeSku.PictureList {
|
||||
@@ -631,7 +631,7 @@ func BatchInitSkuMT2TT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, fromS
|
||||
continue
|
||||
}
|
||||
if strings.Contains(til, "white_") {
|
||||
param.WhiteBackGroundPicUrl = v.ByteUrl
|
||||
param.WhiteBackGroundPicUrl = utils.String2Pointer(v.ByteUrl)
|
||||
}
|
||||
picList = append(picList, v.ByteUrl)
|
||||
}
|
||||
@@ -641,7 +641,7 @@ func BatchInitSkuMT2TT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, fromS
|
||||
if len(param.Pic) != 0 {
|
||||
var vendorCategoryId int64 = 0
|
||||
// 根据图片推导分类
|
||||
picList = append(picList, param.WhiteBackGroundPicUrl, param.Description)
|
||||
picList = append(picList, *param.WhiteBackGroundPicUrl, param.Description)
|
||||
vendorCategoryId, _ = toApi.GetRecommendCategory(picList)
|
||||
// 根据名字推导分类
|
||||
if vendorCategoryId == 0 {
|
||||
@@ -660,16 +660,16 @@ func BatchInitSkuMT2TT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, fromS
|
||||
// 是否支持七天无理由
|
||||
isAfterSale, rule := toApi.GetProductUpdateRule(param.CategoryLeafId)
|
||||
if isAfterSale {
|
||||
param.AfterSaleService = map[string]string{"supply_day_return_selector": fmt.Sprintf("%s", rule)}
|
||||
param.AfterSaleService = &map[string]string{"supply_day_return_selector": fmt.Sprintf("%s", rule)}
|
||||
}
|
||||
|
||||
// weight_unit 目前抖音只支持g和kg两种
|
||||
param.WeightUnit = tiktok_api.WeightUint_G
|
||||
param.WeightUnit = utils.Int64ToPointer(tiktok_api.WeightUint_G)
|
||||
|
||||
// spec_prices
|
||||
//param.SpecPrices = GetSpecPrices(param.Specs, vendorStoreID, 0, storeSku)
|
||||
skuSize := make([]*tiktok_api.SpecDetailList, 0, 0)
|
||||
name1 := strings.Split(strings.Split(param.Specs, "|")[1], ",")
|
||||
name1 := strings.Split(strings.Split(*param.Specs, "|")[1], ",")
|
||||
for _, sl := range storeSku.SkuList {
|
||||
for i := 0; i < len(name1); i++ {
|
||||
if name1[i] == strings.Split(sl.Spec, "*")[0] {
|
||||
@@ -693,16 +693,16 @@ func BatchInitSkuMT2TT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, fromS
|
||||
}
|
||||
}
|
||||
data, _ := json.Marshal(skuSize)
|
||||
param.SpecPrices = string(data)
|
||||
param.SpecPrices = utils.String2Pointer(string(data))
|
||||
|
||||
// 获取商品的属性
|
||||
//param.ProductFormatNew, param.StandardBrandId, err = MakeProductFormatNew(api, int64(storeSku.NameID), param.CategoryLeafId, storeSku.Upc, storeSku.UpcBrandName, storeSku.UpcTiktokBrandId)
|
||||
if upc == "" {
|
||||
param.StandardBrandId = 596120136
|
||||
param.StandardBrandId = utils.Int64ToPointer(596120136)
|
||||
} else {
|
||||
brandName, err := tiktok_store.GetBrandByBrandName(upc)
|
||||
if err != nil {
|
||||
param.StandardBrandId = 596120136
|
||||
param.StandardBrandId = utils.Int64ToPointer(596120136)
|
||||
} else {
|
||||
if strings.Contains(brandName, "/") || strings.Contains(brandName, "(") || strings.Contains(brandName, "(") {
|
||||
brandName = strings.Split(brandName, "/")[0]
|
||||
@@ -715,14 +715,14 @@ func BatchInitSkuMT2TT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, fromS
|
||||
}
|
||||
standardBrandId, err := toApi.GetSkuBrand(param.CategoryLeafId, brandName)
|
||||
if err != nil {
|
||||
param.StandardBrandId = 596120136
|
||||
param.StandardBrandId = utils.Int64ToPointer(596120136)
|
||||
} else {
|
||||
param.StandardBrandId = standardBrandId
|
||||
param.StandardBrandId = &standardBrandId
|
||||
}
|
||||
}
|
||||
}
|
||||
if param.StandardBrandId == 0 {
|
||||
param.StandardBrandId = 596120136
|
||||
if param.StandardBrandId == utils.Int64ToPointer(0) {
|
||||
param.StandardBrandId = utils.Int64ToPointer(596120136)
|
||||
}
|
||||
categoryList, err := toApi.GetCatePropertyV2(param.CategoryLeafId)
|
||||
if err != nil {
|
||||
@@ -753,11 +753,11 @@ func BatchInitSkuMT2TT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, fromS
|
||||
}
|
||||
}
|
||||
|
||||
param.ProductFormatNew = utils.Format4Output(categoryMap, false)
|
||||
param.ProductFormatNew = utils.String2Pointer(utils.Format4Output(categoryMap, false))
|
||||
//param.ProductFormatNew, err = MakeProductFormatNew(api, int64(storeSku.NameID), param.CategoryLeafId)
|
||||
if StoreTemp[toStoreDetail.VendorStoreID] != "" {
|
||||
idList := strings.Split(StoreTemp[toStoreDetail.VendorStoreID], "_")
|
||||
param.FreightId, param.SaleLimitId = utils.Str2Int64(idList[0]), utils.Str2Int64(idList[1])
|
||||
param.FreightId, param.SaleLimitId = utils.Str2Int64(idList[0]), utils.Int64ToPointer(utils.Str2Int64(idList[1]))
|
||||
} else {
|
||||
// 运费模板
|
||||
param.FreightId, err = tiktok_store.GetDeliveryTemp(toApi, toStoreDetail.VendorStoreID, toStoreDetail)
|
||||
@@ -769,7 +769,7 @@ func BatchInitSkuMT2TT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, fromS
|
||||
return errList, nil
|
||||
}
|
||||
// 获取门店限售模板
|
||||
param.SaleLimitId, err = tiktok_store.CreateSaleTemp(utils.Str2Int64(toStoreDetail.VendorStoreID), toApi)
|
||||
saleLimitId, err := tiktok_store.CreateSaleTemp(utils.Str2Int64(toStoreDetail.VendorStoreID), toApi)
|
||||
if err != nil {
|
||||
errList = append(errList, &mtwmapi.AppFoodResult{
|
||||
AppFoodCode: storeSku.AppFoodCode,
|
||||
@@ -777,6 +777,7 @@ func BatchInitSkuMT2TT(ctx *jxcontext.Context, fromSku []*mtwmapi.AppFood, fromS
|
||||
})
|
||||
return errList, nil
|
||||
}
|
||||
param.SaleLimitId = &saleLimitId
|
||||
StoreTemp[toStoreDetail.VendorStoreID] = fmt.Sprintf("%d_%d", param.FreightId, param.SaleLimitId)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user