|
|
@@ -37,7 +37,7 @@ class Lakala
|
|
|
public function close($params)
|
|
|
{
|
|
|
$orderSn = $params['orderSn'];
|
|
|
- $ip = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '';
|
|
|
+ $ip = $this->getClientIp();
|
|
|
$location_info = ['request_ip' => $ip];
|
|
|
$arr = [
|
|
|
'merchant_no' => $this->merchant_no,
|
|
|
@@ -63,7 +63,7 @@ class Lakala
|
|
|
$refundSn = $params['refundSn'];
|
|
|
$refundReason = $params['refundReason'];
|
|
|
$refundAmount = $params['refundAmount'];
|
|
|
- $ip = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '';
|
|
|
+ $ip = $this->getClientIp();
|
|
|
$location_info = ['request_ip' => $ip];
|
|
|
$arr = [
|
|
|
'merchant_no' => $this->merchant_no,
|
|
|
@@ -95,7 +95,7 @@ class Lakala
|
|
|
$capitalType = $params['capitalType'];
|
|
|
$wxAppId = $params['wxAppId'];
|
|
|
$openId = $params['openId'];
|
|
|
- $ip = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '';
|
|
|
+ $ip = $this->getClientIp();
|
|
|
$location_info = ['request_ip' => $ip];
|
|
|
$arr = [
|
|
|
'merchant_no' => $this->merchant_no,
|
|
|
@@ -132,7 +132,7 @@ class Lakala
|
|
|
$notifyUrl = $params['notifyUrl'];
|
|
|
$subject = $params['subject'];
|
|
|
$capitalType = $params['capitalType'];
|
|
|
- $ip = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '';
|
|
|
+ $ip = $this->getClientIp();
|
|
|
$location_info = ['request_ip' => $ip];
|
|
|
$arr = [
|
|
|
'merchant_no' => $this->merchant_no,
|
|
|
@@ -241,4 +241,18 @@ class Lakala
|
|
|
return $params;
|
|
|
}
|
|
|
|
|
|
+ public function getClientIp()
|
|
|
+ {
|
|
|
+ if ($_SERVER['REMOTE_ADDR']) {
|
|
|
+ $cip = $_SERVER['REMOTE_ADDR'];
|
|
|
+ } elseif (getenv("REMOTE_ADDR")) {
|
|
|
+ $cip = getenv("REMOTE_ADDR");
|
|
|
+ } elseif (getenv("HTTP_CLIENT_IP")) {
|
|
|
+ $cip = getenv("HTTP_CLIENT_IP");
|
|
|
+ } else {
|
|
|
+ $cip = "114.55.169.20";
|
|
|
+ }
|
|
|
+ return $cip;
|
|
|
+ }
|
|
|
+
|
|
|
}
|