|
|
@ -68,6 +68,7 @@ class Notify |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function wechatV3(): string |
|
|
|
public function wechatV3(): string |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => "进入回调第二步", 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
try { |
|
|
|
try { |
|
|
|
// 通过微信支付v3平台证书序号 获取支付模板 |
|
|
|
// 通过微信支付v3平台证书序号 获取支付模板 |
|
|
|
$wechatpaySerial = \request()->header('wechatpay-serial'); |
|
|
|
$wechatpaySerial = \request()->header('wechatpay-serial'); |
|
|
@ -84,7 +85,7 @@ class Notify |
|
|
|
$platformCertificateFilePath = PaymentTemplateModel::realPathCertFile( |
|
|
|
$platformCertificateFilePath = PaymentTemplateModel::realPathCertFile( |
|
|
|
PaymentMethodEnum::WECHAT, $fileName, $templateInfo['store_id'] |
|
|
|
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(); |
|
|
|
$V3 = new WechatPaymentV3(); |
|
|
|
$outTradeNo = $V3->notify($apiv3Key, $platformCertificateFilePath); |
|
|
|
$outTradeNo = $V3->notify($apiv3Key, $platformCertificateFilePath); |
|
|
@ -93,6 +94,7 @@ class Notify |
|
|
|
// 获取第三方交易记录 |
|
|
|
// 获取第三方交易记录 |
|
|
|
$tradeInfo = PaymentTradeModel::detailByOutTradeNo($outTradeNo); |
|
|
|
$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()); |
|
|
|
$this->orderPaySucces($tradeInfo, $V3->getNotifyParams()); |
|
|
|
} catch (\Throwable $e) { |
|
|
|
} catch (\Throwable $e) { |
|
|
|
// 记录错误日志 |
|
|
|
// 记录错误日志 |
|
|
@ -137,6 +139,7 @@ class Notify |
|
|
|
'orderType' => OrderTypeEnum::data()[$tradeInfo['order_type']]['name'], |
|
|
|
'orderType' => OrderTypeEnum::data()[$tradeInfo['order_type']]['name'], |
|
|
|
'tradeInfo' => $tradeInfo->toArray(), |
|
|
|
'tradeInfo' => $tradeInfo->toArray(), |
|
|
|
]); |
|
|
|
]); |
|
|
|
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => "进入回调第五步", 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
try { |
|
|
|
try { |
|
|
|
// 订单支付成功业务处理 (商城订单) |
|
|
|
// 订单支付成功业务处理 (商城订单) |
|
|
|
if ($tradeInfo['order_type'] == OrderTypeEnum::ORDER) { |
|
|
|
if ($tradeInfo['order_type'] == OrderTypeEnum::ORDER) { |
|
|
|