From cc026b188e122a10ed8d5d6afb09e4e43f774aac Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 7 May 2024 09:54:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/PayController.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/app/api/controller/PayController.php b/app/api/controller/PayController.php index 1adce3d..77c4698 100644 --- a/app/api/controller/PayController.php +++ b/app/api/controller/PayController.php @@ -3,13 +3,8 @@ namespace app\api\controller; use app\common\enum\PayEnum; -use app\common\enum\user\UserTerminalEnum; use app\common\logic\PayNotifyLogic; use app\common\model\retail\Cashierclass; -use app\common\service\pay\WeChatPayService; -use app\Request; -use Error; -use support\Log; use Webman\Config; use Yansongda\Pay\Pay; @@ -21,7 +16,7 @@ use Yansongda\Pay\Pay; class PayController extends BaseApiController { - public $notNeedLogin = ['notifyMnp', 'aa']; + public $notNeedLogin = ['notifyMnp']; /** * @notes 小程序支付回调 @@ -43,17 +38,17 @@ class PayController extends BaseApiController if ($ciphertext['trade_state'] === 'SUCCESS') { $extra['transaction_id'] = $ciphertext['transaction_id']; $attach = $ciphertext['attach']; - $message['out_trade_no'] = mb_substr($ciphertext['out_trade_no'], 0, 18); switch ($attach) { case 'cashierclass': - $order = Cashierclass::where(['number' => $message['out_trade_no']])->findOrEmpty(); + $order = Cashierclass::where(['number' => $ciphertext['out_trade_no']])->findOrEmpty(); + if ($order->isEmpty() || $order->paid == PayEnum::ISPAID) { return true; } - PayNotifyLogic::handle('cashierclass', $message['out_trade_no'], $ciphertext); + PayNotifyLogic::handle('cashierclass', $ciphertext['out_trade_no'], $ciphertext); + Pay::wechat()->success(); break; } - return Pay::wechat()->success(); } }