mirror of
https://gitee.com/technical-laohu/mpay.git
synced 2025-09-17 09:16:40 +08:00
更新手动补单问题
This commit is contained in:
parent
f9c804c1e5
commit
b56156d33a
@ -97,12 +97,8 @@ class PayController
|
|||||||
$sign = self::getSign($notify, $user_key);
|
$sign = self::getSign($notify, $user_key);
|
||||||
$notify['sign'] = $sign;
|
$notify['sign'] = $sign;
|
||||||
// 跳转通知URL
|
// 跳转通知URL
|
||||||
$res_return_url = '';
|
$res_return_url = $act_order->return_url . '?' . http_build_query($notify);
|
||||||
if (strpos($act_order->return_url, '?')) {
|
if (strpos($act_order->return_url, '?')) $res_return_url = $act_order->return_url . '&' . http_build_query($notify);
|
||||||
$res_return_url = $act_order->return_url . '&' . http_build_query($notify);
|
|
||||||
} else {
|
|
||||||
$res_return_url = $act_order->return_url . '?' . http_build_query($notify);
|
|
||||||
}
|
|
||||||
// 响应消息
|
// 响应消息
|
||||||
$data['order_id'] = $act_order->order_id;
|
$data['order_id'] = $act_order->order_id;
|
||||||
$data['passtime'] = $passtime > 0 ? $passtime : 0;
|
$data['passtime'] = $passtime > 0 ? $passtime : 0;
|
||||||
@ -192,12 +188,8 @@ class PayController
|
|||||||
$sign = self::getSign($notify, $user_key);
|
$sign = self::getSign($notify, $user_key);
|
||||||
$notify['sign'] = $sign;
|
$notify['sign'] = $sign;
|
||||||
// 异步通知
|
// 异步通知
|
||||||
$notify_url = '';
|
$notify_url = $order->notify_url . '?' . http_build_query($notify);
|
||||||
if (strpos($order->notify_url, '?')) {
|
if (strpos($order->notify_url, '?')) $notify_url = $order->notify_url . '&' . http_build_query($notify);
|
||||||
$notify_url = $order->notify_url . '&' . http_build_query($notify);
|
|
||||||
} else {
|
|
||||||
$notify_url = $order->notify_url . '?' . http_build_query($notify);
|
|
||||||
}
|
|
||||||
$res_notify = self::getHttpResponse($notify_url);
|
$res_notify = self::getHttpResponse($notify_url);
|
||||||
if ($res_notify === 'success') {
|
if ($res_notify === 'success') {
|
||||||
return ['order' => $order->order_id, 'code' => 1, 'msg' => 'notify success'];
|
return ['order' => $order->order_id, 'code' => 1, 'msg' => 'notify success'];
|
||||||
@ -280,20 +272,17 @@ class PayController
|
|||||||
{
|
{
|
||||||
$info = $request->post();
|
$info = $request->post();
|
||||||
$action = isset($info['action']) ? $info['action'] : '';
|
$action = isset($info['action']) ? $info['action'] : '';
|
||||||
if ($action === 'mpay') {
|
if ($action !== 'mpay') return '非mpay的访问请求';
|
||||||
$data = json_decode($info['data'], true);
|
$data = json_decode($info['data'], true);
|
||||||
if (!is_array($data)) return 200;
|
if (!is_array($data)) return '通知数据为空';
|
||||||
if (!isset($data['aid']) || !isset($data['pid'])) return 202;
|
if (!isset($data['aid']) || !isset($data['pid'])) return 'aid和pid参数错误';
|
||||||
$config = PayAccount::getAccountConfig($data['aid'], $data['pid']);
|
$config = PayAccount::getAccountConfig($data['aid'], $data['pid']);
|
||||||
$payclient_path = "\\payclient\\{$config['payclass']}";
|
$payclient_path = "\\payclient\\{$config['payclass']}";
|
||||||
$Payclient = new $payclient_path($info, $config);
|
$Payclient = new $payclient_path($info, $config);
|
||||||
$res = $Payclient->notify();
|
$res = $Payclient->notify();
|
||||||
if (is_int($res)) return $res;
|
if ($res['code'] !== 0) return $res['msg'];
|
||||||
$this->payHeart($res, $config);
|
$this->payHeart($res['data'], $config);
|
||||||
return 200;
|
return 200;
|
||||||
} else {
|
|
||||||
return 202;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// 签名
|
// 签名
|
||||||
private static function getSign(array $param = [], string $key = ''): string
|
private static function getSign(array $param = [], string $key = ''): string
|
||||||
|
@ -48,7 +48,9 @@ class OrderController extends BaseController
|
|||||||
$sign = self::getSign($notify, $user_key);
|
$sign = self::getSign($notify, $user_key);
|
||||||
$notify['sign'] = $sign;
|
$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') {
|
if ($res_notify === 'success') {
|
||||||
return json(\backMsg(0, '订单通知成功'));
|
return json(\backMsg(0, '订单通知成功'));
|
||||||
} else {
|
} else {
|
||||||
@ -72,7 +74,9 @@ class OrderController extends BaseController
|
|||||||
$sign = self::getSign($notify, $user_key);
|
$sign = self::getSign($notify, $user_key);
|
||||||
$notify['sign'] = $sign;
|
$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') {
|
if ($res_notify === 'success') {
|
||||||
return json(\backMsg(0, '订单通知成功'));
|
return json(\backMsg(0, '订单通知成功'));
|
||||||
} else {
|
} else {
|
||||||
@ -156,7 +160,8 @@ class OrderController extends BaseController
|
|||||||
'sign_type' => 'MD5',
|
'sign_type' => 'MD5',
|
||||||
];
|
];
|
||||||
// 添加扩展参数
|
// 添加扩展参数
|
||||||
$notify = array_merge($notify, unserialize($param->param));
|
// $notify = array_merge($notify, unserialize($param->param));
|
||||||
|
$notify['param'] = unserialize($param->param);
|
||||||
return $notify;
|
return $notify;
|
||||||
}
|
}
|
||||||
// 请求外部资源
|
// 请求外部资源
|
||||||
|
Loading…
Reference in New Issue
Block a user