This commit is contained in:
邹宗楠
2023-06-30 15:51:32 +08:00
parent 9f79ffe034
commit 1896e20c4d

View File

@@ -276,46 +276,49 @@ func createTaoVegetable(api *tao_vegetable.API, storeSkuList []*dao.StoreSkuSync
for index, storeSku := range storeSkuList {
sku := domain585.AlibabaWdkSkuAddSkuDo{
Barcodes: utils.String2Pointer(utils.Int2Str(storeSku.SkuID)),
BrandName: utils.String2Pointer(tao_vegetable.CreateSkuBrandName),
OuCode: utils.String2Pointer(vendorStoreID),
InventoryUnit: utils.String2Pointer(storeSku.Unit),
ProducerPlace: utils.String2Pointer(tao_vegetable.CreateSkuProducerPlace),
SkuCode: utils.String2Pointer(utils.Int2Str(storeSku.SkuID)),
SkuName: utils.String2Pointer(storeSku.SkuName),
StorageType: utils.Int64ToPointer(tao_vegetable.CreateSkuStorageType),
SuggestedPrice: utils.String2Pointer(utils.Float64ToStr(utils.Int64ToFloat64(storeSku.UnitPrice) / utils.Int64ToFloat64(100))),
Weight: utils.String2Pointer(utils.Float32ToStr(storeSku.SpecQuality)),
ShelfLife: utils.Int64ToPointer(tao_vegetable.CreateShelfLife),
NetContent: utils.String2Pointer(utils.Float32ToStr(storeSku.SpecQuality)),
SaleUnit: utils.String2Pointer(storeSku.SpecUnit),
LifeStatus: utils.String2Pointer(tao_vegetable.CreateSkuLeafStatus),
SaleSpec: utils.String2Pointer(fmt.Sprintf("%f*1%s", storeSku.SpecQuality, storeSku.Unit)),
StepQuantity: utils.Int64ToPointer(model.YES), // 每次购买至少增加一个购买单位
SubTitle: utils.String2Pointer("同城包邮"),
SubTitle1: utils.String2Pointer("一小时速达"),
OnlineSaleFlag: utils.Int64ToPointer(tao_vegetable.CreateOnlineSaleFlag), // 门店控制是否可见
DeliveryUnit: utils.String2Pointer(storeSku.Unit),
Barcodes: utils.String2Pointer(utils.Int2Str(storeSku.SkuID)),
BrandName: utils.String2Pointer(tao_vegetable.CreateSkuBrandName),
OuCode: utils.String2Pointer(vendorStoreID),
//InventoryUnit: utils.String2Pointer(storeSku.Unit),
InventoryUnit: utils.String2Pointer("份"),
ProducerPlace: utils.String2Pointer(tao_vegetable.CreateSkuProducerPlace),
SkuCode: utils.String2Pointer(utils.Int2Str(storeSku.SkuID)),
SkuName: utils.String2Pointer(storeSku.SkuName),
StorageType: utils.Int64ToPointer(tao_vegetable.CreateSkuStorageType),
SuggestedPrice: utils.String2Pointer(utils.Float64ToStr(utils.Int64ToFloat64(storeSku.UnitPrice) / utils.Int64ToFloat64(100))),
Weight: utils.String2Pointer(utils.Float32ToStr(storeSku.SpecQuality)),
ShelfLife: utils.Int64ToPointer(tao_vegetable.CreateShelfLife),
NetContent: utils.String2Pointer(utils.Float32ToStr(storeSku.SpecQuality)),
SaleUnit: utils.String2Pointer(storeSku.SpecUnit),
LifeStatus: utils.String2Pointer(tao_vegetable.CreateSkuLeafStatus),
SaleSpec: utils.String2Pointer(fmt.Sprintf("%.2f*1%s", storeSku.SpecQuality, storeSku.Unit)),
StepQuantity: utils.Int64ToPointer(model.YES), // 每次购买至少增加一个购买单位
SubTitle: utils.String2Pointer("同城包邮"),
SubTitle1: utils.String2Pointer("一小时速达"),
OnlineSaleFlag: utils.Int64ToPointer(tao_vegetable.CreateOnlineSaleFlag), // 门店控制是否可见
//DeliveryUnit: utils.String2Pointer(storeSku.Unit),
DeliveryUnit: utils.String2Pointer("份"),
DeliverySpec: utils.String2Pointer(utils.Int2Str(model.YES)),
MemberPrice: utils.String2Pointer(utils.Float64ToStr(float64(storeSku.UnitPrice) / float64(100))),
Storage: utils.String2Pointer(tao_vegetable.CreateStorage),
PickFloatRate: utils.String2Pointer(utils.Int2Str(model.NO)), // ? 0
ForbidReceiveDays: utils.Int64ToPointer(tao_vegetable.CreateShelfLife), // ? 7
ForbidSalesDays: utils.Int64ToPointer(model.NO), // ? 0
OverloadRate: utils.String2Pointer(utils.Int2Str(model.NO)), // ? 0
WarnDays: utils.Int64ToPointer(model.NO), // ? 0
FixedFlag: utils.Int64ToPointer(model.NO), // ? 0
PurchaseSpec: utils.String2Pointer(utils.Int2Str(model.YES)), // ? 1
PurchaseUnit: utils.String2Pointer(storeSku.Unit), // ? 同上
LabelStyleType: utils.String2Pointer(tao_vegetable.CreateLabelStyleType), // 库存单位
ItemTypeNew: utils.Int64ToPointer(tao_vegetable.CreateItemTypeNewVegetable),
SkuPrice: utils.String2Pointer(utils.Float64ToStr(float64(storeSku.UnitPrice) / float64(100))), // 优先使用skuPrice 靠后SalePrice
Period: utils.Int64ToPointer(tao_vegetable.CreateShelfLife), // 优先使用period 靠后shelf_life
MerchantCatCode: utils.String2Pointer(utils.Int2Str(storeSku.NameCategoryID)), // 优先使用 靠后 category_code
FragileFlag: utils.Int64ToPointer(model.YES),
DeliveryStorage: utils.String2Pointer(tao_vegetable.CreateItemDeliveryStorage),
TemporaryFlag: utils.Int64ToPointer(model.NO),
IsOnline: utils.Int64ToPointer(tao_vegetable.CreateIsOnline),
PickFloatRate: utils.String2Pointer(utils.Int2Str(model.NO)), // ? 0
ForbidReceiveDays: utils.Int64ToPointer(tao_vegetable.CreateShelfLife), // ? 7
ForbidSalesDays: utils.Int64ToPointer(model.NO), // ? 0
OverloadRate: utils.String2Pointer(utils.Int2Str(model.NO)), // ? 0
WarnDays: utils.Int64ToPointer(model.NO), // ? 0
FixedFlag: utils.Int64ToPointer(model.NO), // ? 0
PurchaseSpec: utils.String2Pointer(utils.Int2Str(model.YES)), // ? 1
//PurchaseUnit: utils.String2Pointer(storeSku.Unit), // ? 同上
PurchaseUnit: utils.String2Pointer("份"), // ? 同上
LabelStyleType: utils.String2Pointer(tao_vegetable.CreateLabelStyleType), // 库存单位
ItemTypeNew: utils.Int64ToPointer(tao_vegetable.CreateItemTypeNewVegetable),
SkuPrice: utils.String2Pointer(utils.Float64ToStr(float64(storeSku.UnitPrice) / float64(100))), // 优先使用skuPrice 靠后SalePrice
Period: utils.Int64ToPointer(tao_vegetable.CreateShelfLife), // 优先使用period 靠后shelf_life
MerchantCatCode: utils.String2Pointer(utils.Int2Str(storeSku.NameCategoryID)), // 优先使用 靠后 category_code
FragileFlag: utils.Int64ToPointer(model.YES),
DeliveryStorage: utils.String2Pointer(tao_vegetable.CreateItemDeliveryStorage),
TemporaryFlag: utils.Int64ToPointer(model.NO),
IsOnline: utils.Int64ToPointer(tao_vegetable.CreateIsOnline),
}
sku.SkuPicUrls = uploadImg(api, []string{storeSku.ImgOrigin, storeSku.Img, storeSku.Img2, storeSku.Img3, storeSku.Img4, storeSku.Img5, storeSku.DescImg})
if storeSku.MinOrderCount <= model.YES {
@@ -324,21 +327,22 @@ func createTaoVegetable(api *tao_vegetable.API, storeSkuList []*dao.StoreSkuSync
sku.PurchaseQuantity = utils.Int64ToPointer(int64(storeSku.MinOrderCount)) // 起购单位
}
sku.WeightFlag = utils.Int64ToPointer(tao_vegetable.CreateSkuWeightFlagNo)
sku.AvgWeight = utils.String2Pointer("1") // (重量)
if storeSku.Upc == "" {
//sku.WeightFlag = utils.Int64ToPointer(tao_vegetable.CreateSkuWeightFlagYes)
if storeSku.SpecUnit == "g" || storeSku.SpecUnit == "ml" || storeSku.SpecUnit == "G" || storeSku.SpecUnit == "ML" {
sku.PreMinusWeight = utils.String2Pointer(utils.Float64ToStr(float64(storeSku.SpecQuality) / float64(1000))) // 一个售卖单位按多少库存单位扣款(钱)
//sku.AvgWeight = utils.String2Pointer(utils.Float64ToStr(float64(storeSku.SpecQuality) / float64(1000))) // (重量)
}
if storeSku.SpecUnit == "kg" || storeSku.SpecUnit == "l" || storeSku.SpecUnit == "KG" || storeSku.SpecUnit == "L" {
sku.PreMinusWeight = utils.String2Pointer(utils.Float64ToStr(float64(storeSku.SpecQuality))) // 每个购买单位重量,预扣重量
//sku.AvgWeight = utils.String2Pointer(utils.Float64ToStr(float64(storeSku.SpecQuality) / float64(1000))) // (重量)
}
} else {
//sku.WeightFlag = utils.Int64ToPointer(tao_vegetable.CreateSkuWeightFlagNo)
sku.PreMinusWeight = utils.String2Pointer("1") // 每个购买单位重量,预扣重量
}
sku.AvgWeight = utils.String2Pointer("1") // (重量)
sku.PreMinusWeight = utils.String2Pointer("1") // 每个购买单位重量,预扣重量
//if storeSku.Upc == "" {
// //sku.WeightFlag = utils.Int64ToPointer(tao_vegetable.CreateSkuWeightFlagYes)
// if storeSku.SpecUnit == "g" || storeSku.SpecUnit == "ml" || storeSku.SpecUnit == "G" || storeSku.SpecUnit == "ML" {
// sku.PreMinusWeight = utils.String2Pointer(utils.Float64ToStr(float64(storeSku.SpecQuality) / float64(1000))) // 一个售卖单位按多少库存单位扣款(钱)
// //sku.AvgWeight = utils.String2Pointer(utils.Float64ToStr(float64(storeSku.SpecQuality) / float64(1000))) // (重量)
// }
// if storeSku.SpecUnit == "kg" || storeSku.SpecUnit == "l" || storeSku.SpecUnit == "KG" || storeSku.SpecUnit == "L" {
// sku.PreMinusWeight = utils.String2Pointer(utils.Float64ToStr(float64(storeSku.SpecQuality))) // 每个购买单位重量,预扣重量
// //sku.AvgWeight = utils.String2Pointer(utils.Float64ToStr(float64(storeSku.SpecQuality) / float64(1000))) // (重量)
// }
//} else {
// //sku.WeightFlag = utils.Int64ToPointer(tao_vegetable.CreateSkuWeightFlagNo)
// sku.PreMinusWeight = utils.String2Pointer("1") // 每个购买单位重量,预扣重量
//}
sku.SkuSuppliers = &[]domain585.AlibabaWdkSkuAddSkuSupplierDo{
domain585.AlibabaWdkSkuAddSkuSupplierDo{
ReturnFlag: utils.Int64ToPointer(model.NO),