From fb36ee4c68572cfd946acddb28fe70bb7067e0cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 13 Jan 2020 11:47:08 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=85=E9=94=80=E5=93=81=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 6239fd793..24d6b3b20 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -2234,7 +2234,7 @@ func GetTopSkusByCityCode(ctx *jxcontext.Context, cityCode, storeID int) (skuNam var skuNameList []*model.SkuName //不可售的商品nameID列表 sql := ` - SELECT DISTINCT b.name_id id,1 brand_id + SELECT DISTINCT b.name_id id FROM store_sku_bind a JOIN sku b ON a.sku_id = b.id AND b.deleted_at = ? WHERE a.deleted_at = ? @@ -2273,12 +2273,13 @@ func GetTopSkusByCityCode(ctx *jxcontext.Context, cityCode, storeID int) (skuNam payPercentage = store.PayPercentage } for _, v := range skuNameAndPlace { + var skuMap = make(map[int]*dao.StoreSkuSyncInfo) if skuNameMap[v.ID] != nil { - priceReferList, _ := dao.GetPriceReferSnapshotNoPage(db, []int{cityCode}, nil, []int{v.ID}, utils.Time2Date(time.Now().AddDate(0, 0, -1))) - if len(priceReferList) > 0 { - v.UnitPrice = priceReferList[0].MidUnitPrice * payPercentage / 100 + storeSkuSyncInfo, _ := dao.GetStoreSkusAndSkuName(db, []int{storeID}, nil, []int{v.ID}) + for _, storeSkuSync := range storeSkuSyncInfo { + skuMap[storeSkuSync.ID] = storeSkuSync } - v.Type = skuNameMap[v.ID].BrandID + v.UnitPrice = int(storeSkuSyncInfo[0].UnitPrice) skuList, _ := dao.GetSkus(db, nil, []int{v.ID}, nil, nil) v.Skus = skuList for _, vv := range skuList { @@ -2286,20 +2287,9 @@ func GetTopSkusByCityCode(ctx *jxcontext.Context, cityCode, storeID int) (skuNam storeSkuNameExt []*dao.StoreSkuNameExt skusList []*dao.StoreSkuExt price int - specQuality float64 ) vv.StoreSkuStatus = model.StoreSkuBindStatusDontSale - if vv.Unit == model.SpecialUnit { - if vv.SpecUnit == model.SpecUnitNames[1] || vv.SpecUnit == model.SpecUnitNames[2] { - specQuality = float64(vv.SpecQuality) * 1000 - } else { - specQuality = float64(vv.SpecQuality) - } - price = int(utils.Float64TwoInt64(specQuality / utils.Int2Float64(model.SpecialSpecQuality) * utils.Int2Float64(v.UnitPrice))) - } else { - price = v.UnitPrice - } - vv.Price = price + vv.Price = int(skuMap[vv.ID].Price) skus := &dao.StoreSkuExt{ SkuID: vv.ID, BindPrice: price,