门店评分修改

This commit is contained in:
Rosy-zhudan
2019-09-10 08:48:58 +08:00
parent db5d628e75
commit 46f31a7136
2 changed files with 60 additions and 23 deletions

View File

@@ -6,14 +6,13 @@ import (
"sync"
"time"
"git.rosy.net.cn/jx-callback/globals/refutil"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/globals/refutil"
)
const (
@@ -28,16 +27,17 @@ const (
ItemTotalScore = 10
StoreOpenTimeNormalTime = 12.0 //小时
SaleSkuNormalCount = 1000
SaleSkuScorePerUnit = float64(ItemTotalScore) / SaleSkuNormalCount
PromotionSkuNormalCount = 20
AveragePickupTimeNormalTime = 10.0 //分钟
BadCommentOrderNormalRatio = 0.2
UnfinishOrderNormalRatio = 1.0
StoreRangeGoodRadius = 2.0 //千米
StoreRangeBadRadius = 1.0 //千米
SaleSkuPriceRatio = 90 //百分比
StoreOpenTimeNormalTime = 12.0 //小时
SaleSkuNormalCount = 1000 //数量
SaleSkuScorePerUnit = float64(ItemTotalScore) / SaleSkuNormalCount //分数
PromotionSkuNormalCount = 20 //数量
AveragePickupTimeNormalTime = 10.0 //分钟
BadCommentOrderNormalRatio = 0.2 //百分比
UnfinishOrderNormalRatio = 1.0 //百分比
AbsentGoodsOrderNormalRatio = 1.0 //百分比
StoreRangeGoodRadius = 2.0 //千米
StoreRangeBadRadius = 1.0 //千米
SaleSkuPriceRatio = 90 //百分比
)
var (
@@ -263,7 +263,27 @@ func ScoreUnfinishOrder(storeList []*cms.StoreExt) {
//缺货订单和完成订单比小于1%得10分比例每增加0.1%减1分
func ScoreAbsentGoodsOrder(storeList []*cms.StoreExt) {
for _, storeInfo := range storeList {
storeID := storeInfo.ID
storeName := storeInfo.Name
db := dao.GetDB()
absentGoodsOrderCount, _ := dao.GetDailyAbsentGoodsOrderCount(db, storeID)
finishOrderCount, _ := dao.GetDailyFinishOrderCount(db, storeID)
if finishOrderCount > 0 {
finalScore := 0
absentGoodsOrderRatio := float64(absentGoodsOrderCount) * 100 / float64(finishOrderCount)
if absentGoodsOrderRatio <= AbsentGoodsOrderNormalRatio {
finalScore = ItemTotalScore
} else {
decScore := int(math.Round((absentGoodsOrderRatio - AbsentGoodsOrderNormalRatio) / 0.1))
finalScore = ItemTotalScore - decScore
if finalScore < 0 {
finalScore = 0
}
}
storeScoreDataWrapper.SetData(storeID, storeName, model.FieldAbsentGoodsOrder, finalScore)
}
}
}
//促销品数量20个以上为满分10分每少2个扣1分
@@ -461,11 +481,16 @@ func GetFilterStoreListEx(storeList []*cms.StoreExt, storeIDMap map[int]int) (ou
continue
}
}
var tempStoreMaps []map[string]interface{}
for _, vendorStoreInfo := range storeInfo.StoreMaps {
vendorID := int(utils.MustInterface2Int64(vendorStoreInfo["vendorID"]))
if _, ok := fullVendorList[vendorID]; !ok {
continue
}
tempStoreMaps = append(tempStoreMaps, vendorStoreInfo)
}
if len(tempStoreMaps) > 0 {
storeInfo.StoreMaps = tempStoreMaps
outStoreList = append(outStoreList, storeInfo)
}
}