|
|
|
@ -75,13 +75,7 @@ class UserAddressService implements UserAddressServiceInterface |
|
|
|
{ |
|
|
|
$address = $this->get($userAddressId); |
|
|
|
$market = Market::query()->select('lng','lat')->find($marketId); |
|
|
|
$result = $this->locationService->getDistanceByTencent($address->lng,$address->lat,$market->lng,$market->lat); |
|
|
|
$resultArr = json_decode($result,true); |
|
|
|
if($resultArr['status'] > 0) |
|
|
|
{ |
|
|
|
throw new ErrorCodeException(ErrorCode::LOCATION_ERROR,$resultArr['message']); |
|
|
|
} |
|
|
|
$distance = $resultArr['result']['routes'][0]['distance']; |
|
|
|
$distance = $this->locationService->getDistanceByTencent($address->lng,$address->lat,$market->lng,$market->lat); |
|
|
|
$distributionRrice = $this->calculateDistributionRrice($distance); |
|
|
|
$res['address'] = $address; |
|
|
|
$res['distribution_price'] = $distributionRrice; |
|
|
|
|