更新
This commit is contained in:
parent
df2bf1d143
commit
fe300a6cd9
@ -73,20 +73,25 @@ class RetailOrderController extends BaseApiController
|
||||
$user = User::where('id', $this->request->userId)->find();
|
||||
$cartId = (array)$this->request->post('cart_id', []);
|
||||
$mer_id = (array)$this->request->post('mer_id', 0);
|
||||
if ($mer_id <= 0) {
|
||||
$pay_type = (int)$this->request->post('pay_type');
|
||||
$addressId = (int)$this->request->post('address_id');
|
||||
$auth_code = $this->request->post('auth_code'); //微信支付条码
|
||||
$params = $this->request->post();
|
||||
if ($mer_id <= 0 && $pay_type!=9) {
|
||||
return $this->fail('自提点不能为空');
|
||||
}
|
||||
if (count($cartId) > 100) {
|
||||
return $this->fail('购物车商品不能超过100个');
|
||||
}
|
||||
$addressId = (int)$this->request->post('address_id');
|
||||
$pay_type = (int)$this->request->post('pay_type');
|
||||
$auth_code = $this->request->post('auth_code'); //微信支付条码
|
||||
$params = $this->request->post();
|
||||
|
||||
if($pay_type==9){
|
||||
|
||||
}
|
||||
$order = OrderLogic::createOrder($cartId, $addressId, null, $params);
|
||||
if ($order != false) {
|
||||
switch ($pay_type) {
|
||||
case PayEnum::WECHAT_PAY:
|
||||
//余额支付
|
||||
$user = User::where('id', $this->request->userId)->find();
|
||||
$res = RetailOrderLogic::payBalance($user, $order);
|
||||
if (RetailOrderLogic::hasError()) {
|
||||
@ -100,6 +105,7 @@ class RetailOrderController extends BaseApiController
|
||||
}
|
||||
break;
|
||||
case PayEnum::WECHAT_PAY:
|
||||
//微信支付
|
||||
$redirectUrl = $params['redirect'] ?? '/pages/payment/payment';
|
||||
$result = PaymentLogic::pay($pay_type, 'cashierclass', $order, $this->userInfo['terminal'], $redirectUrl);
|
||||
if (PaymentLogic::hasError()) {
|
||||
@ -108,6 +114,7 @@ class RetailOrderController extends BaseApiController
|
||||
return $this->success('', $result);
|
||||
break;
|
||||
case PayEnum::WECHAT_PAY_BARCODE:
|
||||
//微信条码支付
|
||||
$result = PaymentLogic::codepay($auth_code, $order);
|
||||
if (PaymentLogic::hasError()) {
|
||||
return $this->fail(PaymentLogic::getError(), $params);
|
||||
|
@ -58,6 +58,9 @@ class PayNotifyLogic extends BaseLogic
|
||||
$order->money = bcdiv($extra['amount']['payer_total'],100,2);
|
||||
$order->paid = 1;
|
||||
$order->status = 1;
|
||||
if($order->pay_type==9){
|
||||
$order->status = 2;
|
||||
}
|
||||
$order->save();
|
||||
if ($order['cart_id']) {
|
||||
if (!is_array($order['cart_id'])) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user