|
@@ -16,26 +16,29 @@ use Plugin\Cache; |
|
@@ -16,26 +16,29 @@ use Plugin\Cache; |
16
|
|
16
|
|
17
|
class Yohobuy
|
17
|
class Yohobuy
|
18
|
{
|
18
|
{
|
19
|
-
|
|
|
20
|
/* 正式环境 */
|
19
|
/* 正式环境 */
|
|
|
20
|
+
|
21
|
// const API_URL = 'http://api2.open.yohobuy.com/';
|
21
|
// const API_URL = 'http://api2.open.yohobuy.com/';
|
22
|
// const API_URL2 = 'http://api.open.yohobuy.com/';
|
22
|
// const API_URL2 = 'http://api.open.yohobuy.com/';
|
23
|
// const SERVICE_URL = 'http://service.api.yohobuy.com/';
|
23
|
// const SERVICE_URL = 'http://service.api.yohobuy.com/';
|
24
|
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
|
24
|
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
|
25
|
|
25
|
|
26
|
/* 测试环境 */
|
26
|
/* 测试环境 */
|
27
|
- const API_URL = 'http://test2.open.yohobuy.com/';
|
|
|
28
|
- const SERVICE_URL = 'http://test.service.api.yohobuy.com/';
|
27
|
+ const API_URL = 'http://devapi.yoho.cn:58078/';
|
|
|
28
|
+ const SERVICE_URL = 'http://devservice.yoho.cn:58077/';
|
29
|
const YOHOBUY_URL = 'http://www.yohobuy.com/';
|
29
|
const YOHOBUY_URL = 'http://www.yohobuy.com/';
|
30
|
- const API_URL_MYCENTER = 'http://192.168.102.205:8081/api-gateway-web/'; // 我的个人中心接口URL
|
30
|
+ const YOHOBUY_ORDER = 'http://192.168.102.205:8084/order/'; //我的订单
|
|
|
31
|
+ const API_URL_MYCENTER = 'http://192.168.102.205:8081/users/'; // 我的个人中心接口URL
|
31
|
const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL
|
32
|
const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL
|
32
|
- const API_URL_PRODUCTDETAIL = 'http://192.168.102.209:18080/yoho-product/'; // 商品详情页
|
33
|
+ const API_URL_PRODUCTDETAIL = 'http://192.168.102.205:8083/product/'; // 商品详情页
|
|
|
34
|
+ const API_URL_LOGISTICS = 'http://192.168.102.205:8080/gateway'; //查看物流接口URL
|
33
|
|
35
|
|
34
|
/**
|
36
|
/**
|
35
|
* 私钥列表
|
37
|
* 私钥列表
|
36
|
*
|
38
|
*
|
37
|
* @var array
|
39
|
* @var array
|
38
|
*/
|
40
|
*/
|
|
|
41
|
+
|
39
|
private static $privateKeyList = array(
|
42
|
private static $privateKeyList = array(
|
40
|
'android' => 'fd4ad5fcfa0de589ef238c0e7331b585',
|
43
|
'android' => 'fd4ad5fcfa0de589ef238c0e7331b585',
|
41
|
'iphone' => 'a85bb0674e08986c6b115d5e3a4884fa',
|
44
|
'iphone' => 'a85bb0674e08986c6b115d5e3a4884fa',
|
|
@@ -62,6 +65,25 @@ class Yohobuy |
|
@@ -62,6 +65,25 @@ class Yohobuy |
62
|
}
|
65
|
}
|
63
|
|
66
|
|
64
|
/**
|
67
|
/**
|
|
|
68
|
+ * 取得当前的IP地址
|
|
|
69
|
+ *
|
|
|
70
|
+ * @param bool $int 返回int类型的ip地址,默认是
|
|
|
71
|
+ * @return mixed 当前的IP地址
|
|
|
72
|
+ */
|
|
|
73
|
+ public static function ip($int = true)
|
|
|
74
|
+ {
|
|
|
75
|
+ if (isset($_SERVER['HTTP_CLIENT_IP']) && $_SERVER['HTTP_CLIENT_IP']) {
|
|
|
76
|
+ $onlineip = $_SERVER['HTTP_CLIENT_IP'];
|
|
|
77
|
+ } elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR']) {
|
|
|
78
|
+ $onlineip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
|
|
79
|
+ } else {
|
|
|
80
|
+ $onlineip = $_SERVER['REMOTE_ADDR'];
|
|
|
81
|
+ }
|
|
|
82
|
+
|
|
|
83
|
+ return $int ? ip2long($onlineip) : $onlineip;
|
|
|
84
|
+ }
|
|
|
85
|
+
|
|
|
86
|
+ /**
|
65
|
* 取得公共的参数
|
87
|
* 取得公共的参数
|
66
|
*
|
88
|
*
|
67
|
* @return array
|
89
|
* @return array
|
|
@@ -103,7 +125,7 @@ class Yohobuy |
|
@@ -103,7 +125,7 @@ class Yohobuy |
103
|
|
125
|
|
104
|
/**
|
126
|
/**
|
105
|
* get方式调用接口
|
127
|
* get方式调用接口
|
106
|
- *
|
128
|
+ *
|
107
|
* @param string $url 接口URL
|
129
|
* @param string $url 接口URL
|
108
|
* @param array $data 参数列表
|
130
|
* @param array $data 参数列表
|
109
|
* @parma mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
|
131
|
* @parma mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
|
|
@@ -393,7 +415,7 @@ class Yohobuy |
|
@@ -393,7 +415,7 @@ class Yohobuy |
393
|
* @param array $cookie
|
415
|
* @param array $cookie
|
394
|
* @return mixed
|
416
|
* @return mixed
|
395
|
*/
|
417
|
*/
|
396
|
- public static function jsonPost($url, $data = array(), $returnJson = false, $timeout = 3, $cookie = array())
|
418
|
+ public static function jsonPost($url, $data = array(), $returnJson = false, $timeout = 30, $cookie = array())
|
397
|
{
|
419
|
{
|
398
|
$ch = curl_init($url);
|
420
|
$ch = curl_init($url);
|
399
|
|
421
|
|