更新验证条件
This commit is contained in:
parent
b2523aaab6
commit
c6f2cadf2c
@ -43,24 +43,6 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
if ($addressId) {
|
||||
$addressRepository = app()->make(UserAddressRepository::class);
|
||||
$address = $addressRepository->getWhere(['uid' => $uid, 'address_id' => $addressId]);
|
||||
$cartProductType = Db::name('StoreCart')->where('cart_id', $cartId[0] ?? 0)->value('product_type');
|
||||
if ($cartProductType == 0) {
|
||||
$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);
|
||||
|
@ -21,6 +21,7 @@ use crmeb\services\SmsService;
|
||||
use crmeb\services\SwooleTaskService;
|
||||
use crmeb\services\YunxinSmsService;
|
||||
use think\App;
|
||||
use think\facade\Db;
|
||||
use crmeb\basic\BaseController;
|
||||
use app\common\repositories\system\merchant\MerchantIntentionRepository as repository;
|
||||
use think\exception\ValidateException;
|
||||
@ -44,8 +45,10 @@ class MerchantIntention extends BaseController
|
||||
return app('json')->fail('未开启商户入驻');
|
||||
}
|
||||
if ($this->userInfo) $data['uid'] = $this->userInfo->uid;
|
||||
if ($this->userInfo->account == $data['phone'])
|
||||
throw new ValidateException('手机号账户已存在,不可申请');
|
||||
$newUid = Db::name('User')->where('account', $data['phone'])->value('uid', 0);
|
||||
if (!$newUid && ($this->userInfo->uid != $newUid)) {
|
||||
throw new ValidateException('该申请手机已存在账户,不可申请');
|
||||
}
|
||||
$make = app()->make(MerchantRepository::class);
|
||||
if ($make->fieldExists('mer_name', $data['mer_name']))
|
||||
throw new ValidateException('商户名称已存在,不可申请');
|
||||
|
@ -98,8 +98,29 @@ class StoreOrder extends BaseController
|
||||
$uid = $this->request->uid();
|
||||
if (!($count = count($cartId)) || $count != count($cartRepository->validIntersection($cartId, $uid)))
|
||||
return app('json')->fail('数据无效');
|
||||
// if (!$addressId)
|
||||
// return app('json')->fail('请选择地址');
|
||||
|
||||
if ($addressId) {
|
||||
$addressRepository = app()->make(UserAddressRepository::class);
|
||||
$address = $addressRepository->getWhere(['uid' => $uid, 'address_id' => $addressId]);
|
||||
$cartProductType = Db::name('StoreCart')->where('cart_id', $cartId[0] ?? 0)->value('product_type');
|
||||
if ($cartProductType == 0) {
|
||||
$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('该收货区域未配送快递员');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$groupOrder = app()->make(LockService::class)->exec('order.create', function () use ($orderCreateRepository, $receipt_data, $mark, $extend, $cartId, $payType, $takes, $couponIds, $useIntegral, $addressId, $post) {
|
||||
return $orderCreateRepository->v2CreateOrder(array_search($payType, StoreOrderRepository::PAY_TYPE), $this->request->userInfo(), $cartId, $extend, $mark, $receipt_data, $takes, $couponIds, $useIntegral, $addressId, $post);
|
||||
|
Loading…
x
Reference in New Issue
Block a user