|
|
|
@ -7,6 +7,7 @@ use App\Constants\v3\LogLabel; |
|
|
|
use App\Constants\v3\OrderState; |
|
|
|
use App\Controller\BaseController; |
|
|
|
use App\Exception\ErrorCodeException; |
|
|
|
use App\Model\v3\Market; |
|
|
|
use App\Model\v3\OrderMain; |
|
|
|
use App\Request\v3\OrderOnlineDetailRequest; |
|
|
|
use App\Request\v3\OrderOnlineRequest; |
|
|
|
@ -14,9 +15,10 @@ use App\Request\v3\OrderOnlineStateRequest; |
|
|
|
use App\Request\v3\UserRequest; |
|
|
|
use App\Service\v3\Implementations\PaymentService; |
|
|
|
use App\Service\v3\Interfaces\CouponRecServiceInterface; |
|
|
|
use App\Service\v3\Interfaces\DistributionPriceServiceInterface; |
|
|
|
use App\Service\v3\Interfaces\LocationServiceInterface; |
|
|
|
use App\Service\v3\Interfaces\SeparateAccountsServiceInterface; |
|
|
|
use App\Service\v3\Interfaces\ShopCartServiceInterface; |
|
|
|
use App\Service\v3\Interfaces\UserAddressServiceInterface; |
|
|
|
use Hyperf\DbConnection\Db; |
|
|
|
use Hyperf\Di\Annotation\Inject; |
|
|
|
use App\Service\v3\Interfaces\OrderOnlineServiceInterface; |
|
|
|
@ -63,9 +65,15 @@ class OrderOnlineController extends BaseController |
|
|
|
|
|
|
|
/** |
|
|
|
* @Inject |
|
|
|
* @var UserAddressServiceInterface |
|
|
|
* @var LocationServiceInterface |
|
|
|
*/ |
|
|
|
protected $userAddressService; |
|
|
|
protected $locationService; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Inject |
|
|
|
* @var DistributionPriceServiceInterface |
|
|
|
*/ |
|
|
|
protected $distributionPriceService; |
|
|
|
|
|
|
|
/* |
|
|
|
* 如果没有绑手机号去绑定页面 |
|
|
|
@ -94,10 +102,27 @@ class OrderOnlineController extends BaseController |
|
|
|
->orderByDesc('is_default') |
|
|
|
->orderByDesc('updated_at') |
|
|
|
->first(); |
|
|
|
$market = Market::find($marketId); |
|
|
|
if(!empty($address->lng) && !empty($address->lat)){ |
|
|
|
$distance = $this->locationService->getDistanceByTencent($market->lng,$market->lat,$address->lng,$address->lat); |
|
|
|
} |
|
|
|
|
|
|
|
if(isset($distance) && $distance > 8000){ |
|
|
|
$distributionPrice = $this->distributionPriceService->do($distance); |
|
|
|
$res['location'] = [ |
|
|
|
'address' => $address, |
|
|
|
'distribution_price' => 0 |
|
|
|
'distribution_price' => $distributionPrice, |
|
|
|
'distance' => $distance, |
|
|
|
'within' => true |
|
|
|
]; |
|
|
|
}else{ |
|
|
|
$res['location'] = [ |
|
|
|
'address' => '', |
|
|
|
'distribution_price' => 3.5, |
|
|
|
'distance' => $distance, |
|
|
|
'within' => false |
|
|
|
]; |
|
|
|
} |
|
|
|
//返回预约送达时间 数组
|
|
|
|
$res['appointment_time'] = $this->appointmentTimeService->get($shopcartIds); |
|
|
|
|
|
|
|
|