|
|
@@ -16,6 +16,7 @@ namespace app\api\controller;
|
|
|
|
|
|
|
|
|
use app\api\validate\PayValidate;
|
|
|
+use app\common\enum\PayEnum;
|
|
|
use app\common\enum\user\UserTerminalEnum;
|
|
|
use app\common\logic\PaymentLogic;
|
|
|
use app\common\service\pay\AliPayService;
|
|
|
@@ -61,29 +62,13 @@ class PayController extends BaseApiController
|
|
|
}
|
|
|
//支付流程
|
|
|
$redirectUrl = $params['redirect'] ?? '/pages/payment/payment';
|
|
|
- $result = PaymentLogic::pay($params['pay_way'], $params['from'], $order, $this->userInfo['terminal'], $redirectUrl);
|
|
|
- if (false === $result) {
|
|
|
- return $this->fail(PaymentLogic::getError(), $params);
|
|
|
- }
|
|
|
- $result['sn'] = $order['sn'];
|
|
|
- return $this->success('', $result);
|
|
|
- }
|
|
|
|
|
|
- /**
|
|
|
- * 微信二维码预支付
|
|
|
- * @return \think\response\Json
|
|
|
- */
|
|
|
- public function preNativePay()
|
|
|
- {
|
|
|
- $params = (new PayValidate())->post()->goCheck();
|
|
|
- //订单信息
|
|
|
- $order = PaymentLogic::getPayOrderInfo($params);
|
|
|
- if (false === $order) {
|
|
|
- return $this->fail(PaymentLogic::getError(), $params);
|
|
|
+ if ($params['pay_way'] == PayEnum::WECHAT_NATIVE_PAY) {
|
|
|
+ //微信二维码预支付
|
|
|
+ $result = PaymentLogic::pay(2, $params['from'], $order, 4, $redirectUrl);
|
|
|
+ } else {
|
|
|
+ $result = PaymentLogic::pay($params['pay_way'], $params['from'], $order, $this->userInfo['terminal'], $redirectUrl);
|
|
|
}
|
|
|
- //支付流程
|
|
|
- $redirectUrl = $params['redirect'] ?? '/pages/payment/payment';
|
|
|
- $result = PaymentLogic::pay($params['pay_way'], $params['from'], $order, 4, $redirectUrl);
|
|
|
if (false === $result) {
|
|
|
return $this->fail(PaymentLogic::getError(), $params);
|
|
|
}
|
|
|
@@ -91,7 +76,6 @@ class PayController extends BaseApiController
|
|
|
return $this->success('', $result);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* @notes 获取支付状态
|
|
|
* @return \think\response\Json
|