Request.php
1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/**
* 请求数据
* User: ziy
* Date: 14-7-8
* Time: 下午6:07
*/
class YOHOPay_Package_Request
{
/**
* 订单号
* @var string
*/
public $orderCode;
/**
* 编码后的订单号
* @var string
*/
public $orderCodeString;
/**
* 订单名称
* @var string
*/
public $orderName;
/**
* 商品名称
* @var string
*/
public $goodsName;
/**
* 用户UID
* @var integer
*/
public $userID;
/**
* 用户
* @var string
*/
public $userName = '';
/**
* 订单创建时间
* @var int
*/
public $createTime = 0;
/**
* 付款总金额
* @var int
*/
public $feeTotal = 0;
/**
* 客户IP
* @var string
*/
public $clientIP = '0.0.0.0';
/**
* 订单过期时间
* @var int
*/
public $orderExpireTime = 0;
public function __construct()
{
$this->clientIP = $this->getClientIp();
}
/**
* 获取客户端ip
* @return String
*/
public function getClientIp()
{
if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")) {
$ip = getenv("HTTP_CLIENT_IP");
} elseif (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown")) {
$ip = getenv("HTTP_X_FORWARDED_FOR");
} elseif (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown")) {
$ip = getenv("REMOTE_ADDR");
} elseif (isset ($_SERVER ["REMOTE_ADDR"]) && $_SERVER ["REMOTE_ADDR"] && strcasecmp($_SERVER ['REMOTE_ADDR'], "unknown")) {
$ip = $_SERVER ["REMOTE_ADDR"];
} else {
$ip = "0.0.0.0";
}
return $ip;
}
}