fix(epay): createOrderApi 补传 clientip 参数(mapi.php 必填)

This commit is contained in:
testadmin
2026-04-16 23:49:52 +08:00
parent f3eb260841
commit 9ca6c646db
+6 -1
View File
@@ -131,10 +131,14 @@ class Epay
/**
* API 模式下单(mapi.php
*
* @param string $clientIp 下单用户的 IPmapi.php 必填,否则报 "用户IP地址(clientip)不能为空"
* @return array|null
*/
public function createOrderApi($orderNo, $type, $amount, $name, $notifyUrl, $returnUrl = '', $param = '')
public function createOrderApi($orderNo, $type, $amount, $name, $notifyUrl, $returnUrl = '', $param = '', $clientIp = '')
{
if ($clientIp === '' || $clientIp === null) {
$clientIp = \think\Request::instance()->ip();
}
$params = [
'pid' => strval($this->config['pid'] ?? ''),
'type' => $type,
@@ -144,6 +148,7 @@ class Epay
'name' => $name,
'money' => strval($amount),
'param' => $param,
'clientip' => strval($clientIp),
'sign_type' => 'MD5',
];
$params['sign'] = $this->generateSign($params);