fix(epay): createOrderApi 补传 clientip 参数(mapi.php 必填)
This commit is contained in:
+6
-1
@@ -131,10 +131,14 @@ class Epay
|
|||||||
/**
|
/**
|
||||||
* API 模式下单(mapi.php)
|
* API 模式下单(mapi.php)
|
||||||
*
|
*
|
||||||
|
* @param string $clientIp 下单用户的 IP(mapi.php 必填,否则报 "用户IP地址(clientip)不能为空")
|
||||||
* @return array|null
|
* @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 = [
|
$params = [
|
||||||
'pid' => strval($this->config['pid'] ?? ''),
|
'pid' => strval($this->config['pid'] ?? ''),
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
@@ -144,6 +148,7 @@ class Epay
|
|||||||
'name' => $name,
|
'name' => $name,
|
||||||
'money' => strval($amount),
|
'money' => strval($amount),
|
||||||
'param' => $param,
|
'param' => $param,
|
||||||
|
'clientip' => strval($clientIp),
|
||||||
'sign_type' => 'MD5',
|
'sign_type' => 'MD5',
|
||||||
];
|
];
|
||||||
$params['sign'] = $this->generateSign($params);
|
$params['sign'] = $this->generateSign($params);
|
||||||
|
|||||||
Reference in New Issue
Block a user