修改
This commit is contained in:
@@ -445,18 +445,20 @@ func ScoreStoreRange(storeInfo *cms.StoreExt) {
|
|||||||
finalScore := 0
|
finalScore := 0
|
||||||
storeID := storeInfo.ID
|
storeID := storeInfo.ID
|
||||||
if storeInfo.DeliveryRangeType == model.DeliveryRangeTypePolygon {
|
if storeInfo.DeliveryRangeType == model.DeliveryRangeTypePolygon {
|
||||||
points := jxutils.CoordinateStr2Points(storeInfo.DeliveryRange)
|
if storeInfo.DeliveryRange != "" {
|
||||||
area := jxutils.CalcPolygonAreaByLngAndLat(points)
|
points := jxutils.CoordinateStr2Points(storeInfo.DeliveryRange)
|
||||||
goodArea := math.Pi * StoreRangeGoodRadius * StoreRangeGoodRadius
|
area := jxutils.CalcPolygonAreaByLngAndLat(points)
|
||||||
badArea := math.Pi * StoreRangeBadRadius * StoreRangeBadRadius
|
goodArea := math.Pi * StoreRangeGoodRadius * StoreRangeGoodRadius
|
||||||
if area >= goodArea {
|
badArea := math.Pi * StoreRangeBadRadius * StoreRangeBadRadius
|
||||||
finalScore = ItemTotalScore
|
if area >= goodArea {
|
||||||
} else if area <= badArea {
|
finalScore = ItemTotalScore
|
||||||
finalScore = 0
|
} else if area <= badArea {
|
||||||
} else {
|
finalScore = 0
|
||||||
diff := goodArea - area
|
} else {
|
||||||
ratio := float64(ItemTotalScore) / (goodArea - badArea)
|
diff := goodArea - area
|
||||||
finalScore = ItemTotalScore - int(math.Round(diff*ratio))
|
ratio := float64(ItemTotalScore) / (goodArea - badArea)
|
||||||
|
finalScore = ItemTotalScore - int(math.Round(diff*ratio))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if storeInfo.DeliveryRangeType == model.DeliveryRangeTypeRadius {
|
} else if storeInfo.DeliveryRangeType == model.DeliveryRangeTypeRadius {
|
||||||
deliveryRadius := utils.Str2Float64WithDefault(storeInfo.DeliveryRange, 0) / 1000
|
deliveryRadius := utils.Str2Float64WithDefault(storeInfo.DeliveryRange, 0) / 1000
|
||||||
|
|||||||
Reference in New Issue
Block a user