|
|
|
@ -38,7 +38,7 @@ class Checkout extends Controller |
|
|
|
|
* @throws \cores\exception\BaseException |
|
|
|
|
*/ |
|
|
|
|
public function order(string $mode = 'buyNow'): Json |
|
|
|
|
{ |
|
|
|
|
{ |
|
|
|
|
if ($mode === 'buyNow') { |
|
|
|
|
return $this->buyNow(); |
|
|
|
|
} elseif ($mode === 'cart') { |
|
|
|
@ -79,6 +79,7 @@ class Checkout extends Controller |
|
|
|
|
'goodsSkuId' => '', |
|
|
|
|
'goodsNum' => 0, |
|
|
|
|
])); |
|
|
|
|
// print_r($params); |
|
|
|
|
// 表单验证 |
|
|
|
|
if (!$this->getValidate()->scene('buyNow')->check($params)) { |
|
|
|
|
return $this->renderError($this->getValidate()->getError(), ['isCreated' => false]); |
|
|
|
@ -91,11 +92,16 @@ class Checkout extends Controller |
|
|
|
|
(int)$params['goodsNum'] |
|
|
|
|
); |
|
|
|
|
$merchantId = 0; |
|
|
|
|
|
|
|
|
|
foreach ($goodsList as $g) { |
|
|
|
|
$merchantId = $g['merchant_id']; |
|
|
|
|
} |
|
|
|
|
// 获取订单确认信息 |
|
|
|
|
$orderInfo = $Checkout->onCheckout($goodsList); |
|
|
|
|
// echo "<pre>"; |
|
|
|
|
// print_r($orderInfo['goodsList']->toArray()); |
|
|
|
|
// exit; |
|
|
|
|
// print_r($this->request->isGet()); |
|
|
|
|
if ($this->request->isGet()) { |
|
|
|
|
return $this->renderSuccess([ |
|
|
|
|
'order' => $orderInfo, |
|
|
|
@ -108,7 +114,7 @@ class Checkout extends Controller |
|
|
|
|
return $this->renderError($Checkout->getError(), ['isCreated' => false]); |
|
|
|
|
} |
|
|
|
|
// 创建订单 增加订单 |
|
|
|
|
$orderInfo['merchantId'] = $merchantId; |
|
|
|
|
$orderInfo['merchantId'] = $merchantId; |
|
|
|
|
if ($merchantId) { |
|
|
|
|
$model = \app\store\model\Merchant::detail($merchantId, $this->storeId); |
|
|
|
|
$orderInfo['commission_ratio'] = $model['commission_ratio']; |
|
|
|
|