From a17211c679f9931b885e76d6543797395222ddf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 18 Mar 2021 09:55:11 +0800 Subject: [PATCH] aa --- business/jxstore/cms/sku.go | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index a6fc6e20d..84ef15188 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -1656,14 +1656,28 @@ func GetJdUpcCodeByName(ctx *jxcontext.Context, name, upcCode string) (productIn } } else { productInfos, err = GetJdUpcCodeByCode(ctx, upcCode) + if len(productInfos) == 0 { + if result, err := api.MtwmAPI.GetStandardProductListWithCond(upcCode); err == nil && result != nil { + productInfo := &jdapi.ProductInfo{ + OriginalName: result.Name, + OriginalSpec: result.Spec, + } + _, name, _, specUnit, unit, specQuality := jxutils.SplitSkuName(productInfo.OriginalName) + productInfo.Name = name + productInfo.SpecUnit = specUnit + productInfo.Unit = unit + productInfo.SpecQuality = specQuality + productInfo.ImgList = strings.Split(result.Pic, ",") + productInfo.Weight = float32(result.Weight) + productInfo.Price = result.AvgPrice + productInfo.BrandName = result.BrandNamePath + productInfos = append(productInfos, productInfo) + } + } } return productInfos, err } -func GetMTUpcCodeByCode(upcCode string) { - -} - func UpdateSkuNamesExPrefix(ctx *jxcontext.Context, nameIDs []int, imgWaterMark string, vendorID int, exPrefix, fromTime, toTime string, isAsync, isContinueWhenError bool) (hint string, err error) { var ( fromTimeP time.Time