中位价价格算法修改,乘除换一下
This commit is contained in:
@@ -2392,10 +2392,10 @@ func RefershStoreSkusMidPrice(ctx *jxcontext.Context, storeIDs []int) (err error
|
||||
return err
|
||||
}
|
||||
if len(priceReferList) > 0 {
|
||||
if storeSku.UnitPrice > priceReferList[0].MidUnitPrice*payPercentage/100 {
|
||||
if storeSku.UnitPrice > priceReferList[0].MidUnitPrice/payPercentage*100 {
|
||||
skuBindInfo := &StoreSkuBindInfo{
|
||||
NameID: priceReferList[0].NameID,
|
||||
UnitPrice: priceReferList[0].MidUnitPrice * payPercentage / 100,
|
||||
UnitPrice: priceReferList[0].MidUnitPrice / payPercentage * 100,
|
||||
}
|
||||
skuBindInfos = append(skuBindInfos, skuBindInfo)
|
||||
}
|
||||
@@ -3013,7 +3013,7 @@ func FocusStoreSkusBySku(ctx *jxcontext.Context, skuBindInfos []*StoreSkuBindInf
|
||||
}
|
||||
priceReferList, _ := dao.GetPriceReferSnapshotNoPage(db, []int{store.CityCode}, nil, []int{skuList[0].NameID}, utils.Time2Date(time.Now().AddDate(0, 0, -1)))
|
||||
if len(priceReferList) > 0 {
|
||||
price = priceReferList[0].MidUnitPrice * payPercentage / 100
|
||||
price = priceReferList[0].MidUnitPrice / payPercentage * 100
|
||||
}
|
||||
}
|
||||
skuBindSkuInfo := &StoreSkuBindSkuInfo{
|
||||
@@ -3121,7 +3121,7 @@ func AutoFocusStoreSkusForTopSkus(ctx *jxcontext.Context, isAsync, isContinueWhe
|
||||
}
|
||||
priceReferList, err := dao.GetPriceReferSnapshotNoPage(db, []int{vv.CityCode}, nil, []int{vv.ID}, utils.Time2Date(time.Now().AddDate(0, 0, -1)))
|
||||
if err == nil && len(priceReferList) > 0 {
|
||||
storeSkuBindInfo.UnitPrice = priceReferList[0].MidUnitPrice * payPercentage / 100
|
||||
storeSkuBindInfo.UnitPrice = priceReferList[0].MidUnitPrice / payPercentage * 100
|
||||
}
|
||||
skuBindInfoList = append(skuBindInfoList, storeSkuBindInfo)
|
||||
}
|
||||
|
||||
@@ -107,9 +107,12 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn
|
||||
return result, err
|
||||
}
|
||||
for _, v := range storeList {
|
||||
if v.PayPercentage < 50 {
|
||||
continue
|
||||
}
|
||||
var tList []*tStoreSkuBindAndSkuName
|
||||
sql := `
|
||||
SELECT DISTINCT b.city_code, a.store_id, Round(a.unit_price/IF(b.pay_percentage < 50 , 70, b.pay_percentage) * 100) AS unit_price, c.name_id
|
||||
SELECT DISTINCT b.city_code, a.store_id, Round(a.unit_price * IF(b.pay_percentage < 50 , 70, b.pay_percentage) / 100) AS unit_price, c.name_id
|
||||
FROM store_sku_bind a
|
||||
JOIN store b ON b.id = a.store_id AND b.deleted_at = ? AND b.status != ?
|
||||
JOIN sku c ON c.id = a.sku_id
|
||||
|
||||
@@ -574,7 +574,7 @@ func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore
|
||||
|
||||
func GetStorePriceScoreSnapshot(db *DaoDB, snapDate time.Time) (storePriceScoreSnapshot []*model.StorePriceScoreSnapshot, err error) {
|
||||
sql := `
|
||||
SELECT c.store_id,ROUND(count(c.unit_price/IF(d.pay_percentage < 50 , 70, d.pay_percentage)*100 <= a.mid_unit_price or NULL)/count(*)*100,2) score
|
||||
SELECT c.store_id,ROUND(count(c.unit_price * IF(d.pay_percentage < 50 , 70, d.pay_percentage) / 100 <= a.mid_unit_price or NULL)/count(*)*100,2) score
|
||||
FROM price_refer_snapshot a
|
||||
JOIN store_sku_bind c ON c.sku_id = a.sku_id AND c.status = ? AND c.deleted_at = ?
|
||||
JOIN store d ON c.store_id = d.id AND d.city_code = a.city_code AND d.deleted_at = ? AND d.status != ?
|
||||
|
||||
Reference in New Issue
Block a user