This commit is contained in:
邹宗楠
2023-07-25 10:22:05 +08:00
parent 5618869ee2
commit 33b5d630e2
2 changed files with 20 additions and 16 deletions

View File

@@ -348,16 +348,16 @@ func Init() {
//666965,
//666714,
//666708,
666705,
103437,
103349,
103123,
103121,
103106,
103038,
103028,
103019,
102831,
//666705,
//103437,
//103349,
//103123,
//103121,
//103106,
//103038,
//103028,
//103019,
//102831,
102751,
//上海
668462,
@@ -418,7 +418,7 @@ func Init() {
"05:30:00",
"07:30:00",
"09:55:00",
"10:55:00",
"10:30:00",
"11:55:00",
"12:55:00",
"13:30:00",

View File

@@ -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 {