畅销商品

This commit is contained in:
苏尹岚
2019-12-24 17:51:27 +08:00
parent afd3bbfea3
commit e811b3fc75
2 changed files with 9 additions and 7 deletions

View File

@@ -2235,8 +2235,8 @@ func GetTopSkusByCityCode(ctx *jxcontext.Context, cityCode, storeID int) (skuNam
}
for _, v := range skuNameAndPlace {
if skuNameMap[v.ID] != nil {
midPrice, err := dao.GetMidPriceByNameID(db, cityCode, v.ID, utils.Time2Date(time.Now().AddDate(0, 0, -1)))
if err == nil {
midPrice, _ := dao.GetMidPriceByNameID(db, cityCode, v.ID, utils.Time2Date(time.Now().AddDate(0, 0, -1)))
if midPrice != 0 {
v.Price = midPrice
}
v.Type = skuNameMap[v.ID].BrandID

View File

@@ -1352,7 +1352,7 @@ func GetMidPriceByNameID(db *DaoDB, cityCode, skuNameID int, snapDate time.Time)
skuMap = make(map[int]int)
)
sql := `
SELECT a.mid_price bind_price,a.sku_id,b.spec_quality
SELECT a.mid_price bind_price,a.sku_id,b.spec_quality sku_spec_quality
FROM price_refer_snapshot a
JOIN sku b ON a.sku_id = b.id
JOIN sku_name c ON c.id = b.name_id
@@ -1369,10 +1369,12 @@ func GetMidPriceByNameID(db *DaoDB, cityCode, skuNameID int, snapDate time.Time)
if err != nil {
return 0, err
}
for _, v := range storeSkuExt {
price = model.SpecialSpecQuality / int(utils.Float64TwoInt64(float64(v.SkuSpecQuality))) * v.BindPrice
if skuMap[skuNameID] < price {
skuMap[skuNameID] = price
if len(storeSkuExt) > 0 {
for _, v := range storeSkuExt {
price = model.SpecialSpecQuality / int(utils.Float64TwoInt64(float64(v.SkuSpecQuality))) * v.BindPrice
if skuMap[skuNameID] < price {
skuMap[skuNameID] = price
}
}
}
return skuMap[skuNameID], err