更新下单判断区域是否配送快递员
This commit is contained in:
parent
fd63b23618
commit
ba21c2c5fc
@ -43,6 +43,21 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
if ($addressId) {
|
||||
$addressRepository = app()->make(UserAddressRepository::class);
|
||||
$address = $addressRepository->getWhere(['uid' => $uid, 'address_id' => $addressId]);
|
||||
$userAddressCode = ($address['province_code'] ?? '') . ',' . ($address['city_code'] ?? '') . ',' . ($address['district_code'] ?? '') . ',' . ($address['street_code'] ?? '') . ',' . ($address['village_code'] ?? '') . ',' . ($address['brigade_id'] ?? 0);
|
||||
$getUrl = env('LOGISTICS_HOST_URL') . '/api/hasCourier?user_address_code=' . $userAddressCode;
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $getUrl);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 2);
|
||||
$hasCourierData = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
if (!empty($hasCourierData) && is_string($hasCourierData)) {
|
||||
$courierData = json_decode($hasCourierData, true);
|
||||
if (empty($courierData['code']) || $courierData['code'] != 1) {
|
||||
throw new ValidateException('该收货区域未配送快递员');
|
||||
}
|
||||
}
|
||||
}
|
||||
$storeCartRepository = app()->make(StoreCartRepository::class);
|
||||
$res = $storeCartRepository->checkCartList($storeCartRepository->cartIbByData($cartId, $uid, $address), 0, $user);
|
||||
@ -943,7 +958,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
if ($orderInfo['order_price'] > 1000000) {
|
||||
throw new ValidateException('支付金额超出最大限制');
|
||||
}
|
||||
if ($orderInfo['status'] == 'noDeliver') throw new ValidateException('部分商品不支持该区域');
|
||||
if ($orderInfo['status'] == 'noDeliver') throw new ValidateException('商品不支持该区域');
|
||||
if ($orderInfo['status'] == 'noAddress') throw new ValidateException('请选择地址');
|
||||
if (!$order_model && $orderInfo['allow_address']) {
|
||||
if (!$orderInfo['address']) throw new ValidateException('请选择正确的收货地址');
|
||||
|
@ -82,12 +82,10 @@ class StoreOrder extends BaseController
|
||||
$mark = (array)$this->request->param('mark', []);
|
||||
$payType = $this->request->param('pay_type');
|
||||
$post = (array)$this->request->param('post');
|
||||
|
||||
$isPc = $payType === 'pc';
|
||||
if ($isPc) {
|
||||
$payType = 'balance';
|
||||
}
|
||||
|
||||
if (!in_array($payType, StoreOrderRepository::PAY_TYPE, true))
|
||||
return app('json')->fail('请选择正确的支付方式');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user