1
This commit is contained in:
@@ -241,7 +241,7 @@ func UpdateTaoVegetable(api *tao_vegetable.API, storeSkuList []*dao.StoreSkuSync
|
||||
updateSku := domain585.AlibabaWdkSkuUpdateSkuDo{
|
||||
OuCode: utils.String2Pointer(vendorStoreID),
|
||||
SkuCode: utils.String2Pointer(utils.Int2Str(v.SkuID)),
|
||||
SkuName: utils.String2Pointer(checkNameLength(v.SkuName)),
|
||||
SkuName: utils.String2Pointer(checkNameLength(v.SkuName, v.Weight, v.Unit)),
|
||||
MemberPrice: utils.String2Pointer("0"),
|
||||
SkuPrice: price, // 优先使用skuPrice 靠后SalePrice
|
||||
SuggestedPrice: price, // 优先使用skuPrice 靠后SalePrice
|
||||
@@ -254,7 +254,8 @@ func UpdateTaoVegetable(api *tao_vegetable.API, storeSkuList []*dao.StoreSkuSync
|
||||
} else {
|
||||
updateSku.PurchaseQuantity = utils.Int64ToPointer(int64(v.MinOrderCount)) // 起购单位
|
||||
}
|
||||
updateSku.SkuPicUrls = uploadImg(api, []string{v.Img, v.Img2, v.Img3, v.Img4, v.Img5, v.DescImg})
|
||||
// 修改暂时不修改图片,保持效率
|
||||
//updateSku.SkuPicUrls = uploadImg(api, []string{v.Img, v.Img2, v.Img3, v.Img4, v.Img5, v.DescImg})
|
||||
updateSkuList = append(updateSkuList, updateSku)
|
||||
}
|
||||
|
||||
@@ -326,7 +327,7 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku
|
||||
if sku.SkuPicUrls == nil {
|
||||
continue
|
||||
}
|
||||
sku.SkuName = utils.String2Pointer(checkNameLength(storeSku.Name))
|
||||
sku.SkuName = utils.String2Pointer(checkNameLength(storeSku.Name, storeSku.Weight, storeSku.Unit))
|
||||
|
||||
if storeSku.MinOrderCount <= model.YES {
|
||||
sku.PurchaseQuantity = utils.Int64ToPointer(model.YES) // 起购单位
|
||||
@@ -385,8 +386,11 @@ func createTaoVegetable(ctx *jxcontext.Context, api *tao_vegetable.API, storeSku
|
||||
return failedList, nil
|
||||
}
|
||||
|
||||
func checkNameLength(name string) string {
|
||||
func checkNameLength(name string, weight int, uint string) string {
|
||||
lastName := ""
|
||||
if !strings.Contains(name, uint) {
|
||||
name = fmt.Sprintf("%s %d/%s", name, weight, uint)
|
||||
}
|
||||
if strings.Contains(name, "其它") {
|
||||
name = strings.ReplaceAll(name, "其它", "")
|
||||
}
|
||||
@@ -434,7 +438,7 @@ func checkNameLength(name string) string {
|
||||
return lastName
|
||||
}
|
||||
}
|
||||
return name[0:60]
|
||||
return lastName[0:60]
|
||||
}
|
||||
|
||||
func uploadImg(api *tao_vegetable.API, imgs []string) *string {
|
||||
|
||||
Reference in New Issue
Block a user