This commit is contained in:
邹宗楠
2023-07-06 18:52:36 +08:00
parent ec7db3f16f
commit 0f329f8ded

View File

@@ -240,13 +240,14 @@ func UpdateTaoVegetable(api *tao_vegetable.API, storeSkuList []*dao.StoreSkuSync
updateSkuList := make([]domain585.AlibabaWdkSkuUpdateSkuDo, 0, 0)
totalCount := len(storeSkuList)
for index, v := range storeSkuList {
price := utils.String2Pointer(utils.Float64ToStr(float64(v.VendorPrice) / float64(100)))
updateSku := domain585.AlibabaWdkSkuUpdateSkuDo{
OuCode: utils.String2Pointer(vendorStoreID),
SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)),
SkuName: utils.String2Pointer(v.SkuName),
MemberPrice: utils.String2Pointer(utils.Float64ToStr(float64(v.VendorPrice) / float64(100))),
SkuPrice: utils.String2Pointer(utils.Float64ToStr(float64(v.VendorPrice) / float64(100))), // 优先使用skuPrice 靠后SalePrice
SuggestedPrice: utils.String2Pointer(utils.Float64ToStr(float64(v.VendorPrice) / float64(100))), // 优先使用skuPrice 靠后SalePrice
MemberPrice: price,
SkuPrice: price, // 优先使用skuPrice 靠后SalePrice
SuggestedPrice: price, // 优先使用skuPrice 靠后SalePrice
CategoryCode: utils.String2Pointer(utils.Int2Str(v.CategoryID)),
MerchantCatCode: utils.String2Pointer(v.VendorCatID), // 优先使用 靠后 category_code
}
@@ -284,6 +285,7 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku
vendorSkuIdMap := make(map[string]string, 0)
for index, storeSku := range storeSkuList {
price := utils.String2Pointer(utils.Float64ToStr(utils.Int64ToFloat64(storeSku.VendorPrice) / utils.Int64ToFloat64(100)))
sku := domain585.AlibabaWdkSkuAddSkuDo{
Barcodes: utils.String2Pointer(utils.Int2Str(storeSku.SkuID)),
BrandName: utils.String2Pointer(tao_vegetable.CreateSkuBrandName),
@@ -294,7 +296,7 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku
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.VendorPrice) / utils.Int64ToFloat64(100))),
SuggestedPrice: price,
Weight: utils.String2Pointer(utils.Float32ToStr(storeSku.SpecQuality)),
ShelfLife: utils.Int64ToPointer(tao_vegetable.CreateShelfLife),
NetContent: utils.String2Pointer(utils.Float32ToStr(storeSku.SpecQuality)),
@@ -308,7 +310,7 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku
//DeliveryUnit: utils.String2Pointer(storeSku.Unit),
DeliveryUnit: utils.String2Pointer("份"),
DeliverySpec: utils.String2Pointer(utils.Int2Str(model.YES)),
MemberPrice: utils.String2Pointer(utils.Float64ToStr(float64(storeSku.VendorPrice) / float64(100))),
MemberPrice: price,
Storage: utils.String2Pointer(tao_vegetable.CreateStorage),
PickFloatRate: utils.String2Pointer(utils.Int2Str(model.NO)), // ? 0
ForbidReceiveDays: utils.Int64ToPointer(tao_vegetable.CreateShelfLife), // ? 7
@@ -321,8 +323,8 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku
PurchaseUnit: utils.String2Pointer("份"), // ? 同上
LabelStyleType: utils.String2Pointer(tao_vegetable.CreateLabelStyleType), // 库存单位
ItemTypeNew: utils.Int64ToPointer(tao_vegetable.CreateItemTypeNewVegetable),
SkuPrice: utils.String2Pointer(utils.Float64ToStr(float64(storeSku.VendorPrice) / float64(100))), // 优先使用skuPrice 靠后SalePrice
Period: utils.Int64ToPointer(tao_vegetable.CreateShelfLife), // 优先使用period 靠后shelf_life
SkuPrice: price, // 优先使用skuPrice 靠后SalePrice
Period: utils.Int64ToPointer(tao_vegetable.CreateShelfLife), // 优先使用period 靠后shelf_life
FragileFlag: utils.Int64ToPointer(model.YES),
DeliveryStorage: utils.String2Pointer(tao_vegetable.CreateItemDeliveryStorage),
TemporaryFlag: utils.Int64ToPointer(model.NO),
@@ -330,6 +332,10 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku
MerchantCatCode: utils.String2Pointer(storeSku.VendorCatID), // 优先使用 靠后 category_code
}
sku.SkuPicUrls = uploadImg(api, []string{storeSku.ImgOrigin, storeSku.Img, storeSku.Img2, storeSku.Img3, storeSku.Img4, storeSku.Img5, storeSku.DescImg})
if sku.SkuPicUrls == nil {
continue
}
if storeSku.MinOrderCount <= model.YES {
sku.PurchaseQuantity = utils.Int64ToPointer(model.YES) // 起购单位
} else {
@@ -523,12 +529,14 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrg
updateSkuList := make([]domain585.AlibabaWdkSkuUpdateSkuDo, 0, 0)
api := getAPI(getStoreVendorOrgCode(storeID), storeID, vendorStoreID)
for index, v := range storeSkuList {
price := utils.String2Pointer(fmt.Sprintf("%.2f", float64(v.VendorPrice)/float64(100)))
updateSku := domain585.AlibabaWdkSkuUpdateSkuDo{
OuCode: utils.String2Pointer(vendorStoreID),
SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)),
SkuPrice: utils.String2Pointer(fmt.Sprintf("%.2f", (float64(1000)/float64(v.SpecQuality))*(float64(v.JxUnitPrice)/float64(100)))),
SkuPrice: price,
CleanSkuMemberPrice: utils.Int64ToPointer(model.YES),
SuggestedPrice: utils.String2Pointer(fmt.Sprintf("%.2f", (float64(1000)/float64(v.SpecQuality))*(float64(v.JxUnitPrice)/float64(100)))),
SuggestedPrice: price,
MemberPrice: price,
}
updateSkuList = append(updateSkuList, updateSku)