更新手动补单问题

This commit is contained in:
技术老胡 2025-01-20 10:00:07 +08:00
parent f9c804c1e5
commit b56156d33a
2 changed files with 23 additions and 29 deletions

View File

@ -97,12 +97,8 @@ class PayController
$sign = self::getSign($notify, $user_key);
$notify['sign'] = $sign;
// 跳转通知URL
$res_return_url = '';
if (strpos($act_order->return_url, '?')) {
$res_return_url = $act_order->return_url . '&' . http_build_query($notify);
} else {
$res_return_url = $act_order->return_url . '?' . http_build_query($notify);
}
$res_return_url = $act_order->return_url . '?' . http_build_query($notify);
if (strpos($act_order->return_url, '?')) $res_return_url = $act_order->return_url . '&' . http_build_query($notify);
// 响应消息
$data['order_id'] = $act_order->order_id;
$data['passtime'] = $passtime > 0 ? $passtime : 0;
@ -192,12 +188,8 @@ class PayController
$sign = self::getSign($notify, $user_key);
$notify['sign'] = $sign;
// 异步通知
$notify_url = '';
if (strpos($order->notify_url, '?')) {
$notify_url = $order->notify_url . '&' . http_build_query($notify);
} else {
$notify_url = $order->notify_url . '?' . http_build_query($notify);
}
$notify_url = $order->notify_url . '?' . http_build_query($notify);
if (strpos($order->notify_url, '?')) $notify_url = $order->notify_url . '&' . http_build_query($notify);
$res_notify = self::getHttpResponse($notify_url);
if ($res_notify === 'success') {
return ['order' => $order->order_id, 'code' => 1, 'msg' => 'notify success'];
@ -280,20 +272,17 @@ class PayController
{
$info = $request->post();
$action = isset($info['action']) ? $info['action'] : '';
if ($action === 'mpay') {
$data = json_decode($info['data'], true);
if (!is_array($data)) return 200;
if (!isset($data['aid']) || !isset($data['pid'])) return 202;
$config = PayAccount::getAccountConfig($data['aid'], $data['pid']);
$payclient_path = "\\payclient\\{$config['payclass']}";
$Payclient = new $payclient_path($info, $config);
$res = $Payclient->notify();
if (is_int($res)) return $res;
$this->payHeart($res, $config);
return 200;
} else {
return 202;
}
if ($action !== 'mpay') return '非mpay的访问请求';
$data = json_decode($info['data'], true);
if (!is_array($data)) return '通知数据为空';
if (!isset($data['aid']) || !isset($data['pid'])) return 'aid和pid参数错误';
$config = PayAccount::getAccountConfig($data['aid'], $data['pid']);
$payclient_path = "\\payclient\\{$config['payclass']}";
$Payclient = new $payclient_path($info, $config);
$res = $Payclient->notify();
if ($res['code'] !== 0) return $res['msg'];
$this->payHeart($res['data'], $config);
return 200;
}
// 签名
private static function getSign(array $param = [], string $key = ''): string

View File

@ -48,7 +48,9 @@ class OrderController extends BaseController
$sign = self::getSign($notify, $user_key);
$notify['sign'] = $sign;
// 异步通知
$res_notify = self::getHttpResponse($order->notify_url . '?' . http_build_query($notify));
$notify_url = $order->notify_url . '?' . http_build_query($notify);
if (strpos($order->notify_url, '?')) $notify_url = $order->notify_url . '&' . http_build_query($notify);
$res_notify = self::getHttpResponse($notify_url);
if ($res_notify === 'success') {
return json(\backMsg(0, '订单通知成功'));
} else {
@ -72,7 +74,9 @@ class OrderController extends BaseController
$sign = self::getSign($notify, $user_key);
$notify['sign'] = $sign;
// 异步通知
$res_notify = self::getHttpResponse($order->notify_url . '?' . http_build_query($notify));
$notify_url = $order->notify_url . '?' . http_build_query($notify);
if (strpos($order->notify_url, '?')) $notify_url = $order->notify_url . '&' . http_build_query($notify);
$res_notify = self::getHttpResponse($notify_url);
if ($res_notify === 'success') {
return json(\backMsg(0, '订单通知成功'));
} else {
@ -156,7 +160,8 @@ class OrderController extends BaseController
'sign_type' => 'MD5',
];
// 添加扩展参数
$notify = array_merge($notify, unserialize($param->param));
// $notify = array_merge($notify, unserialize($param->param));
$notify['param'] = unserialize($param->param);
return $notify;
}
// 请求外部资源