forked from wayhood/getui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GTConfig.php
executable file
·103 lines (87 loc) · 2.96 KB
/
GTConfig.php
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
97
98
99
100
101
102
103
<?php
namespace wh\getui\utils;
class GTConfig
{
public static function isPushSingleBatchAsync()
{
return "true" == GTConfig::getProperty("gexin_pushSingleBatch_needAsync", null, "false");
}
public static function isPushListAsync()
{
return "true" == GTConfig::getProperty("gexin_pushList_needAsync", null, "false");
}
public static function isPushListNeedDetails()
{
return "true" == GTConfig::getProperty("gexin_pushList_needDetails", "needDetails", "false");
}
public static function getHttpProxyIp()
{
return GTConfig::getProperty("gexin_http_proxy_ip", "gexin.rp.sdk.http.proxyHost");
}
public static function getHttpProxyPort()
{
return (int)GTConfig::getProperty("gexin_http_proxy_port", "gexin.rp.sdk.http.proxyPort", 80);
}
public static function getSyncListLimit()
{
return (int)GTConfig::getProperty("gexin_pushList_syncLimit", null, 1000);
}
public static function getAsyncListLimit()
{
return (int)GTConfig::getProperty("gexin_pushList_asyncLimit", null, 10000);
}
public static function getHttpConnectionTimeOut()
{
return (int)GTConfig::getProperty("gexin_http_connecton_timeout", "gexin.rp.sdk.http.connection.timeout", 60000);
}
public static function getHttpInspectInterval()
{
return (int)GTConfig::getProperty("gexin_inspect_interval", "gexin.rp.sdk.http.inspect.timeout", 300000);
}
public static function getHttpSoTimeOut()
{
return (int)GTConfig::getProperty("gexin_http_so_timeout", "gexin.rp.sdk.http.so.timeout", 30000);
}
public static function getHttpTryCount()
{
return (int)GTConfig::getProperty("gexin_http_tryCount", "gexin.rp.sdk.http.gexinTryCount", 3);
}
public static function getDefaultDomainUrl()
{
$urlStr = GTConfig::getProperty("gexin_default_domainurl", null);
if ($urlStr == null || "".equals(trim($urlStr)))
{
$hosts = array("http://sdk.open.api.igexin.com/serviceex","http://sdk.open.api.gepush.com/serviceex","http://sdk.open.api.getui.net/serviceex");
for($i = 0;$i < 3;$i++)
{
array_push($hosts,"http://sdk".$i.".open.api.igexin.com/serviceex");
}
return $hosts;
}
return explode(",",$urlStr);
}
private static function getProperty($key, $oldKey, $defaultValue = null)
{
$value = getenv($key);
if($value != null)
{
return $value;
}
else
if($oldKey != null)
{
$value = getenv($oldKey);
}
if($value == null)
{
return $defaultValue;
}else
{
return $value;
}
}
public static function getSDKVersion()
{
return "4.0.0.1";
}
}