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,