diff --git a/app/api/controller/Notify.php b/app/api/controller/Notify.php index 69c91cf3..3a39ab9f 100644 --- a/app/api/controller/Notify.php +++ b/app/api/controller/Notify.php @@ -12,8 +12,9 @@ declare (strict_types=1); namespace app\api\controller; -use cores\BaseController; use app\api\service\Notify as NotifyService; +use cores\BaseController; +use think\facade\Db; /** * 支付成功异步通知接口 @@ -42,9 +43,11 @@ class Notify extends BaseController */ public function wechatV3(): string { + Db::table('yoshop_wx_server')->insertGetId(['content' => "进入回调第一步", 'created_at' => date('Y-m-d H:i:s')]); try { $NotifyService = new NotifyService; return $NotifyService->wechatV3(); + } catch (\Throwable $e) { return '{"code": "FAIL","message": "失败"}'; } diff --git a/app/api/service/Notify.php b/app/api/service/Notify.php index 7b040fd9..8f712730 100644 --- a/app/api/service/Notify.php +++ b/app/api/service/Notify.php @@ -68,6 +68,7 @@ class Notify */ public function wechatV3(): string { + Db::table('yoshop_wx_server')->insertGetId(['content' => "进入回调第二步", 'created_at' => date('Y-m-d H:i:s')]); try { // 通过微信支付v3平台证书序号 获取支付模板 $wechatpaySerial = \request()->header('wechatpay-serial'); @@ -84,7 +85,7 @@ class Notify $platformCertificateFilePath = PaymentTemplateModel::realPathCertFile( PaymentMethodEnum::WECHAT, $fileName, $templateInfo['store_id'] ); - + Db::table('yoshop_wx_server')->insertGetId(['content' => "进入回调第三步", 'created_at' => date('Y-m-d H:i:s')]); // 验证异步通知是否合法并获取第三方支付交易订单号 $V3 = new WechatPaymentV3(); $outTradeNo = $V3->notify($apiv3Key, $platformCertificateFilePath); @@ -93,6 +94,7 @@ class Notify // 获取第三方交易记录 $tradeInfo = PaymentTradeModel::detailByOutTradeNo($outTradeNo); // 订单支付成功事件 + Db::table('yoshop_wx_server')->insertGetId(['content' => "进入回调第四步", 'created_at' => date('Y-m-d H:i:s')]); $this->orderPaySucces($tradeInfo, $V3->getNotifyParams()); } catch (\Throwable $e) { // 记录错误日志 @@ -137,6 +139,7 @@ class Notify 'orderType' => OrderTypeEnum::data()[$tradeInfo['order_type']]['name'], 'tradeInfo' => $tradeInfo->toArray(), ]); + Db::table('yoshop_wx_server')->insertGetId(['content' => "进入回调第五步", 'created_at' => date('Y-m-d H:i:s')]); try { // 订单支付成功业务处理 (商城订单) if ($tradeInfo['order_type'] == OrderTypeEnum::ORDER) {