门店评分
This commit is contained in:
@@ -65,6 +65,29 @@ func (s *StoreScoreDataWrapper) SetData(storeID int, valueName string, value int
|
|||||||
valueInfo.FieldByName(valueName).SetInt(int64(value))
|
valueInfo.FieldByName(valueName).SetInt(int64(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//得到所有门店的商品
|
||||||
|
func GetAllStoreSkus(ctx *jxcontext.Context, storeList []*cms.StoreExt) {
|
||||||
|
allStoreSkus = make(map[int]map[int]*cms.StoreSkuNameExt)
|
||||||
|
for _, storeInfo := range storeList {
|
||||||
|
storeID := storeInfo.ID
|
||||||
|
jxSkuInfoData, _ := cms.GetStoreSkus(ctx, storeID, []int{}, true, "", true, map[string]interface{}{}, 0, -1)
|
||||||
|
jxSkuMapData := make(map[int]*cms.StoreSkuNameExt)
|
||||||
|
for _, value := range jxSkuInfoData.SkuNames {
|
||||||
|
for _, skuInfo := range value.Skus2 {
|
||||||
|
saleStatus := jxutils.MergeSkuStatus(skuInfo.SkuStatus, skuInfo.StoreSkuStatus)
|
||||||
|
if saleStatus == model.SkuStatusNormal {
|
||||||
|
jxSkuMapData[skuInfo.SkuID] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
allStoreSkus[storeID] = jxSkuMapData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ClearAllStoreSkus() {
|
||||||
|
allStoreSkus = nil
|
||||||
|
}
|
||||||
|
|
||||||
func GetOpenTime(opTimeList []int16) (opTime float64) {
|
func GetOpenTime(opTimeList []int16) (opTime float64) {
|
||||||
opTime = 0
|
opTime = 0
|
||||||
for index, _ := range opTimeList {
|
for index, _ := range opTimeList {
|
||||||
@@ -111,11 +134,11 @@ func ScoreStoreOpenTime(storeList []*cms.StoreExt) {
|
|||||||
func ScoreSaleSkuCount(ctx *jxcontext.Context, storeList []*cms.StoreExt) {
|
func ScoreSaleSkuCount(ctx *jxcontext.Context, storeList []*cms.StoreExt) {
|
||||||
for _, storeInfo := range storeList {
|
for _, storeInfo := range storeList {
|
||||||
storeID := storeInfo.ID
|
storeID := storeInfo.ID
|
||||||
jxSkuInfoData, err := cms.GetStoreSkus(ctx, storeID, []int{}, true, "", true, map[string]interface{}{}, 0, -1)
|
skusMapData := allStoreSkus[storeID]
|
||||||
if err == nil && len(jxSkuInfoData.SkuNames) > 0 {
|
if len(skusMapData) > 0 {
|
||||||
finalScore := 0
|
finalScore := 0
|
||||||
saleSkuCount := 0
|
saleSkuCount := 0
|
||||||
for _, value := range jxSkuInfoData.SkuNames {
|
for _, value := range skusMapData {
|
||||||
for _, skuInfo := range value.Skus2 {
|
for _, skuInfo := range value.Skus2 {
|
||||||
saleStatus := jxutils.MergeSkuStatus(skuInfo.SkuStatus, skuInfo.StoreSkuStatus)
|
saleStatus := jxutils.MergeSkuStatus(skuInfo.SkuStatus, skuInfo.StoreSkuStatus)
|
||||||
if saleStatus == model.SkuStatusNormal {
|
if saleStatus == model.SkuStatusNormal {
|
||||||
@@ -334,29 +357,6 @@ func GetRangeStoreList(storeID int, lng, lat, checkDist float64, storeList []*cm
|
|||||||
return outStoreList
|
return outStoreList
|
||||||
}
|
}
|
||||||
|
|
||||||
//得到所有门店的商品
|
|
||||||
func GetAllStoreSkus(ctx *jxcontext.Context, storeList []*cms.StoreExt) {
|
|
||||||
allStoreSkus = make(map[int]map[int]*cms.StoreSkuNameExt)
|
|
||||||
for _, storeInfo := range storeList {
|
|
||||||
storeID := storeInfo.ID
|
|
||||||
jxSkuInfoData, _ := cms.GetStoreSkus(ctx, storeID, []int{}, true, "", true, map[string]interface{}{}, 0, -1)
|
|
||||||
jxSkuMapData := make(map[int]*cms.StoreSkuNameExt)
|
|
||||||
for _, value := range jxSkuInfoData.SkuNames {
|
|
||||||
for _, skuInfo := range value.Skus2 {
|
|
||||||
saleStatus := jxutils.MergeSkuStatus(skuInfo.SkuStatus, skuInfo.StoreSkuStatus)
|
|
||||||
if saleStatus == model.SkuStatusNormal {
|
|
||||||
jxSkuMapData[skuInfo.SkuID] = value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
allStoreSkus[storeID] = jxSkuMapData
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func ClearAllStoreSkus() {
|
|
||||||
allStoreSkus = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
//得到给定门店列表里的同一SkuID商品的平均价格
|
//得到给定门店列表里的同一SkuID商品的平均价格
|
||||||
func GetStoreSkusAveragePrice(storeList []*cms.StoreExt) map[int]int {
|
func GetStoreSkusAveragePrice(storeList []*cms.StoreExt) map[int]int {
|
||||||
skusTotalPrice := make(map[int]int)
|
skusTotalPrice := make(map[int]int)
|
||||||
@@ -392,7 +392,6 @@ func GetSkusCountLessEqualAvgPrice(storeID int, skusAveragePrice map[int]int) (c
|
|||||||
|
|
||||||
//可售商品价格在附近5km内门店比较,价格低于等于平均值的商品数占90%以上满分10分,比例每降低10%减1分,100%超标得0分
|
//可售商品价格在附近5km内门店比较,价格低于等于平均值的商品数占90%以上满分10分,比例每降低10%减1分,100%超标得0分
|
||||||
func ScoreSaleSkuPrice(ctx *jxcontext.Context, storeList []*cms.StoreExt) {
|
func ScoreSaleSkuPrice(ctx *jxcontext.Context, storeList []*cms.StoreExt) {
|
||||||
GetAllStoreSkus(ctx, storeList)
|
|
||||||
for _, storeInfo := range storeList {
|
for _, storeInfo := range storeList {
|
||||||
finalScore := 0
|
finalScore := 0
|
||||||
storeID := storeInfo.ID
|
storeID := storeInfo.ID
|
||||||
@@ -414,7 +413,6 @@ func ScoreSaleSkuPrice(ctx *jxcontext.Context, storeList []*cms.StoreExt) {
|
|||||||
storeScoreDataWrapper.SetData(storeID, "SaleSkuPrice", finalScore)
|
storeScoreDataWrapper.SetData(storeID, "SaleSkuPrice", finalScore)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ClearAllStoreSkus()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetFilterStoreListEx(storeList []*cms.StoreExt, storeIDMap map[int]int) (outStoreList []*cms.StoreExt) {
|
func GetFilterStoreListEx(storeList []*cms.StoreExt, storeIDMap map[int]int) (outStoreList []*cms.StoreExt) {
|
||||||
@@ -443,17 +441,19 @@ func ScoreStore(ctx *jxcontext.Context, storeIDList []int) (retVal interface{},
|
|||||||
storeIDMap := jxutils.IntList2Map(storeIDList)
|
storeIDMap := jxutils.IntList2Map(storeIDList)
|
||||||
storeList = GetFilterStoreListEx(storeList, storeIDMap)
|
storeList = GetFilterStoreListEx(storeList, storeIDMap)
|
||||||
|
|
||||||
|
// GetAllStoreSkus(ctx, storeList)
|
||||||
ScoreStoreOpenTime(storeList)
|
ScoreStoreOpenTime(storeList)
|
||||||
ScoreSaleSkuCount(ctx, storeList)
|
// ScoreSaleSkuCount(ctx, storeList)
|
||||||
ScoreAveragePickupTime(storeList)
|
ScoreAveragePickupTime(storeList)
|
||||||
ScoreBadCommentOrder(storeList)
|
ScoreBadCommentOrder(storeList)
|
||||||
ScoreUnfinishOrder(storeList)
|
ScoreUnfinishOrder(storeList)
|
||||||
ScoreAbsentGoodsOrder(storeList)
|
// ScoreAbsentGoodsOrder(storeList)
|
||||||
ScorePromotionSku(storeList)
|
ScorePromotionSku(storeList)
|
||||||
ScoreFullVendor(storeList)
|
ScoreFullVendor(storeList)
|
||||||
ScoreStoreRange(storeList)
|
ScoreStoreRange(storeList)
|
||||||
ScoreSaleSkuPrice(ctx, storeList)
|
// ScoreSaleSkuPrice(ctx, storeList)
|
||||||
InsertStoreScore()
|
// InsertStoreScore()
|
||||||
|
// ClearAllStoreSkus()
|
||||||
|
|
||||||
return retVal, err
|
return retVal, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user