diff --git a/business/jxstore/misc/store_score.go b/business/jxstore/misc/store_score.go index 390674fa2..1a3c750c5 100644 --- a/business/jxstore/misc/store_score.go +++ b/business/jxstore/misc/store_score.go @@ -445,18 +445,20 @@ func ScoreStoreRange(storeInfo *cms.StoreExt) { finalScore := 0 storeID := storeInfo.ID if storeInfo.DeliveryRangeType == model.DeliveryRangeTypePolygon { - points := jxutils.CoordinateStr2Points(storeInfo.DeliveryRange) - area := jxutils.CalcPolygonAreaByLngAndLat(points) - goodArea := math.Pi * StoreRangeGoodRadius * StoreRangeGoodRadius - badArea := math.Pi * StoreRangeBadRadius * StoreRangeBadRadius - if area >= goodArea { - finalScore = ItemTotalScore - } else if area <= badArea { - finalScore = 0 - } else { - diff := goodArea - area - ratio := float64(ItemTotalScore) / (goodArea - badArea) - finalScore = ItemTotalScore - int(math.Round(diff*ratio)) + if storeInfo.DeliveryRange != "" { + points := jxutils.CoordinateStr2Points(storeInfo.DeliveryRange) + area := jxutils.CalcPolygonAreaByLngAndLat(points) + goodArea := math.Pi * StoreRangeGoodRadius * StoreRangeGoodRadius + badArea := math.Pi * StoreRangeBadRadius * StoreRangeBadRadius + if area >= goodArea { + finalScore = ItemTotalScore + } else if area <= badArea { + finalScore = 0 + } else { + diff := goodArea - area + ratio := float64(ItemTotalScore) / (goodArea - badArea) + finalScore = ItemTotalScore - int(math.Round(diff*ratio)) + } } } else if storeInfo.DeliveryRangeType == model.DeliveryRangeTypeRadius { deliveryRadius := utils.Str2Float64WithDefault(storeInfo.DeliveryRange, 0) / 1000