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(); } }