diff --git a/app/api/controller/PayController.php b/app/api/controller/PayController.php index a67580bb0..7a6ea7fe1 100755 --- a/app/api/controller/PayController.php +++ b/app/api/controller/PayController.php @@ -145,9 +145,13 @@ class PayController extends BaseApiController */ public function notifyApp() { - $param = $this->request->param(); - return (new WeChatPayService(UserTerminalEnum::ANDROID))->notify($param); + try { + $param = $this->request->param(); + Log::info(['支付系统回调', $param]) + (new WeChatPayService(UserTerminalEnum::ANDROID))->notify($param); + return $this->success('ok'); + } catch (\Exception $e) { + return $this->fail($e->getMessage()); + } } - - } diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 63e0691e4..36718fbcb 100755 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -67,6 +67,7 @@ class PayNotifyLogic extends BaseLogic $order = RechargeOrder::where('sn', $orderSn)->findOrEmpty(); if ($order && isset($order['extend']['type']) && $order['extend']['type'] == 1) { + // ***** 小组服务团队-入股任务逻辑 已废弃 ***** $find = Task::where('id', $order['extend']['task_id'])->find(); $extend=$find['extend']; $extend['shareholder']['order_sn']=$order->sn; @@ -112,7 +113,7 @@ class PayNotifyLogic extends BaseLogic // 更新充值订单状态 $order->transaction_id = $extra['transaction_id']; - $order->pay_status = PayEnum::ISPAID; + $order->pay_status = $extra['pay_status'];; $order->pay_time = time(); $order->save(); } diff --git a/app/common/service/pay/WeChatPayService.php b/app/common/service/pay/WeChatPayService.php index 511c134c0..9faf775dd 100755 --- a/app/common/service/pay/WeChatPayService.php +++ b/app/common/service/pay/WeChatPayService.php @@ -354,44 +354,14 @@ class WeChatPayService extends BasePayService /** * @notes 支付回调 - * @return \Psr\Http\Message\ResponseInterface - * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException - * @throws \EasyWeChat\Kernel\Exceptions\RuntimeException - * @throws \ReflectionException - * @throws \Throwable - * @author 段誉 - * @date 2023/2/28 14:20 */ public function notify($param) { - Log::info(['支付回调', $param]); -// $server = $this->app->getServer(); -// // 支付通知 -// $server->handlePaid(function (Message $message) { -// $data = ['trade_state' => $message['trade_state'] ?? '', 'out_trade_no' => $message['out_trade_no'] ?? '', 'transaction_id' => $message['transaction_id'] ?? '', 'attach' => $message['attach'] ?? '']; -// Log::info('wechat pay notify: ' . var_export($data, true)); -// if ($message['trade_state'] === 'SUCCESS') { -// $extra['transaction_id'] = $message['transaction_id']; -// $attach = $message['attach']; -// $message['out_trade_no'] = mb_substr($message['out_trade_no'], 0, 18); -// switch ($attach) { -// case 'recharge': -// $order = RechargeOrder::where(['sn' => $message['out_trade_no']])->findOrEmpty(); -// if($order->isEmpty() || $order->pay_status == PayEnum::ISPAID) { -// return true; -// } -// PayNotifyLogic::handle('recharge', $message['out_trade_no'], $extra); -// break; -// } -// } -// return true; -// }); -// -// // 退款通知 -// $server->handleRefunded(function (Message $message) { -// return true; -// }); -// return $server->serve(); + Log::info(['支付回调', $param]); + $extra['transaction_id'] = $param['transaction_id']; + $extra['pay_status'] = $param['pay_status']; + PayNotifyLogic::handle('recharge', $param['out_trade_no'], $extra); + return true; } public function configForPayment($prepayId, $appId)