feat: 完善协议管理、师傅资质认证、分账配置并完成测试环境全量部署与同步
这个提交包含在:
@@ -181,9 +181,24 @@ class Api extends Controller
|
||||
public function notifyx()
|
||||
{
|
||||
$paytype = $this->request->param('paytype', $this->request->param('type', 'wechat'));
|
||||
if ($paytype === 'wechat' && Service::isVersionV3()) {
|
||||
try {
|
||||
$rawBody = file_get_contents('php://input') ?: (string)$this->request->getInput();
|
||||
$headers = $this->request->header();
|
||||
$wxSvc = new \app\common\library\WxPayV3Service();
|
||||
$parsed = $wxSvc->verifyAndDecryptNotify((string)$rawBody, is_array($headers) ? $headers : []);
|
||||
if (strtoupper($parsed['event_type']) === 'TRANSACTION.SUCCESS' && !empty($parsed['data']['out_trade_no'])) {
|
||||
\app\common\library\PaymentService::confirmOrderPay((string)$parsed['data']['out_trade_no'], $parsed['data']);
|
||||
}
|
||||
return json(['code' => 'SUCCESS', 'message' => '成功'], 200);
|
||||
} catch (Exception $e) {
|
||||
\think\Log::record("微信V3回调处理失败:" . $e->getMessage(), "error");
|
||||
return json(['code' => 'FAIL', 'message' => '处理失败:' . $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
$pay = Service::checkNotify($paytype);
|
||||
if (!$pay) {
|
||||
return json(['code' => 'FAIL', 'message' => '失败'], 500, ['Content-Type' => 'application/json']);
|
||||
return json(['code' => 'FAIL', 'message' => '回调验签失败'], 500, ['Content-Type' => 'application/json']);
|
||||
}
|
||||
|
||||
// 获取回调数据,V3和V2的回调接收不同
|
||||
@@ -202,10 +217,12 @@ class Api extends Controller
|
||||
$out_trade_no = $data['out_trade_no'];
|
||||
|
||||
\think\Log::record("回调成功,订单号:{$out_trade_no},金额:{$payamount}");
|
||||
|
||||
//你可以在此编写订单逻辑
|
||||
} catch (Exception $e) {
|
||||
if ($paytype === 'wechat' && $out_trade_no !== '') {
|
||||
\app\common\library\PaymentService::confirmOrderPay((string)$out_trade_no, is_array($data) ? $data : null);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
\think\Log::record("回调逻辑处理错误:" . $e->getMessage(), "error");
|
||||
return json(['code' => 'FAIL', 'message' => '回调处理失败:' . $e->getMessage()], 500);
|
||||
}
|
||||
|
||||
//下面这句必须要执行,且在此之前不能有任何输出
|
||||
|
||||
在新工单中引用
屏蔽一个用户