From e1fced0a71e7b2ed3786527b25931c00175210d3 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 14:09:43 +0800 Subject: [PATCH] aa --- business/jxstore/cms/sku.go | 9 +++++++++ business/jxstore/permission/permission.go | 4 +--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index 3f5a37f1a..5b080c5ff 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -1657,6 +1657,9 @@ func GetJdUpcCodeByName(ctx *jxcontext.Context, name, upcCode string) (productIn } else { productInfos, err = GetJdUpcCodeByCode(ctx, upcCode) if len(productInfos) == 0 { + if configs, err := dao.QueryConfigs(dao.GetDB(), "mtwmCookieStr", model.ConfigTypeCookie, ""); err == nil { + api.MtwmAPI.SetCookieWithStr(configs[0].Value) + } if result, err := api.MtwmAPI.GetStandardProductListWithCond(upcCode); err == nil && result != nil { productInfo := &jdapi.ProductInfo{ OriginalName: result.Name, @@ -2344,6 +2347,9 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader, categoryID } skuName.Skus[0].Status = model.SkuStatusNormal if skuName.Img == model.NOSkuNameImg { + if configs, err := dao.QueryConfigs(dao.GetDB(), "mtwmCookieStr", model.ConfigTypeCookie, ""); err == nil { + api.MtwmAPI.SetCookieWithStr(configs[0].Value) + } result, _ := api.MtwmAPI.GetStandardProductListWithCond(*skuName.Upc) if result != nil { imgs := strings.Split(result.Pic, ",") @@ -2376,6 +2382,9 @@ func CreateUpcSkuByExcelBin(ctx *jxcontext.Context, reader io.Reader, categoryID skuName.Img4 = imgs[3] skuName.Img5 = imgs[4] } + } else { + retVal = []*CreateUpcSkuByExcelErr{buildCreateUpcSkuByExcelErr(v, "美团cookie过期了吧")} + return retVal, err } } //需要把图片传到七牛云上, 很难受 diff --git a/business/jxstore/permission/permission.go b/business/jxstore/permission/permission.go index 28ae73342..7e4ab3ebe 100644 --- a/business/jxstore/permission/permission.go +++ b/business/jxstore/permission/permission.go @@ -375,9 +375,7 @@ func GetUserStoresResultMap(userID string) (resultMap map[int]int, err error) { } if stores, err := dao.GetStoreList(db, storeIDs, cityCodes, nil, brandIDs, nil, ""); len(stores) > 0 && err == nil { for _, v := range stores { - if _, ok := resultMap[v.ID]; !ok { - resultMap[v.ID] = v.ID - } + resultMap[v.ID] = v.ID } } }