|
|
|
@ -26,7 +26,6 @@ use app\common\library\payment\Facade as PaymentFacade; |
|
|
|
|
use app\common\library\payment\gateway\Driver; |
|
|
|
|
use app\common\library\payment\gateway\driver\wechat\V3 as WechatPaymentV3; |
|
|
|
|
use cores\exception\BaseException; |
|
|
|
|
use think\facade\Db; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 服务类:第三方支付异步通知 |
|
|
|
@ -68,7 +67,6 @@ 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'); |
|
|
|
@ -85,7 +83,6 @@ 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); |
|
|
|
@ -94,7 +91,6 @@ 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) { |
|
|
|
|
// 记录错误日志 |
|
|
|
@ -139,7 +135,6 @@ 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) { |
|
|
|
@ -187,10 +182,6 @@ class Notify |
|
|
|
|
} |
|
|
|
|
// 订单支付成功业务处理 (开通采购商) |
|
|
|
|
if ($tradeInfo['order_type'] == OrderTypeEnum::WHOLESALER) { |
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => "进入采购商回调", 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($tradeInfo), 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => "paymentData数据", 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($paymentData), 'created_at' => date('Y-m-d H:i:s')]); |
|
|
|
|
$service = new wholesaler\PaySuccess(); |
|
|
|
|
$service->setOrderNo($tradeInfo['order_no']) |
|
|
|
|
->setMethod($tradeInfo['pay_method']) |
|
|
|
|