更新支付

This commit is contained in:
mkm 2024-05-07 09:54:16 +08:00
parent 5fd64338dc
commit cc026b188e

View File

@ -3,13 +3,8 @@
namespace app\api\controller; namespace app\api\controller;
use app\common\enum\PayEnum; use app\common\enum\PayEnum;
use app\common\enum\user\UserTerminalEnum;
use app\common\logic\PayNotifyLogic; use app\common\logic\PayNotifyLogic;
use app\common\model\retail\Cashierclass; use app\common\model\retail\Cashierclass;
use app\common\service\pay\WeChatPayService;
use app\Request;
use Error;
use support\Log;
use Webman\Config; use Webman\Config;
use Yansongda\Pay\Pay; use Yansongda\Pay\Pay;
@ -21,7 +16,7 @@ use Yansongda\Pay\Pay;
class PayController extends BaseApiController class PayController extends BaseApiController
{ {
public $notNeedLogin = ['notifyMnp', 'aa']; public $notNeedLogin = ['notifyMnp'];
/** /**
* @notes 小程序支付回调 * @notes 小程序支付回调
@ -43,17 +38,17 @@ class PayController extends BaseApiController
if ($ciphertext['trade_state'] === 'SUCCESS') { if ($ciphertext['trade_state'] === 'SUCCESS') {
$extra['transaction_id'] = $ciphertext['transaction_id']; $extra['transaction_id'] = $ciphertext['transaction_id'];
$attach = $ciphertext['attach']; $attach = $ciphertext['attach'];
$message['out_trade_no'] = mb_substr($ciphertext['out_trade_no'], 0, 18);
switch ($attach) { switch ($attach) {
case 'cashierclass': 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) { if ($order->isEmpty() || $order->paid == PayEnum::ISPAID) {
return true; return true;
} }
PayNotifyLogic::handle('cashierclass', $message['out_trade_no'], $ciphertext); PayNotifyLogic::handle('cashierclass', $ciphertext['out_trade_no'], $ciphertext);
Pay::wechat()->success();
break; break;
} }
return Pay::wechat()->success();
} }
} }