Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
郝肖肖
9 years ago
Commit
21f8c5455f70eafed66af7ca4944f5f1466ac069
1 parent
2c92ffaa
server 分流
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
1 deletions
library/Api/Yohobuy.php
yohobuy/www.yohobuy.com/public/index-dev.php
yohobuy/www.yohobuy.com/public/index-old.php
yohobuy/www.yohobuy.com/public/index-pre.php
yohobuy/www.yohobuy.com/public/index-test.php
yohobuy/www.yohobuy.com/public/index.php
library/Api/Yohobuy.php
View file @
21f8c54
...
...
@@ -64,6 +64,17 @@ class Yohobuy
'h5'
=>
'fd4ad5fcfa0de589ef238c0e7331b585'
,
);
//分流服务器接口
public
static
$interfaceShunt
=
array
(
'tencentServers'
=>
array
(
'api'
=>
array
(
'123.206.1.98'
,
'123.206.2.80'
),
'service'
=>
array
(
'123.206.1.98'
,
'123.206.2.80'
)
),
'awsServers'
=>
array
(
'api'
=>
array
(
'app-java-168863769.cn-north-1.elb.amazonaws.com.cn'
),
'service'
=>
array
(
'service-yoho-579825100.cn-north-1.elb.amazonaws.com.cn'
)
)
);
/**
* 取得当前的客户端类型
...
...
@@ -167,6 +178,9 @@ class Yohobuy
*/
public
static
function
get
(
$url
,
$data
=
array
(),
$cache
=
false
,
$returnJson
=
false
,
$timeout
=
5
,
$userAgent
=
null
,
$useGzip
=
true
)
{
$url
=
self
::
_getUrl
(
$url
,
$data
);
// 销毁私钥参数
if
(
isset
(
$data
[
'private_key'
]))
{
unset
(
$data
[
'private_key'
]);
...
...
@@ -229,8 +243,9 @@ class Yohobuy
*/
public
static
function
post
(
$url
,
$data
=
array
(),
$returnJson
=
false
,
$timeout
=
10
,
$header
=
array
(),
$cookie
=
array
())
{
$
ch
=
curl_init
(
$url
);
$
url
=
self
::
_getUrl
(
$url
,
$data
);
$ch
=
curl_init
(
$url
);
curl_setopt
(
$ch
,
CURLOPT_TIMEOUT
,
$timeout
);
if
(
!
empty
(
$header
))
{
curl_setopt
(
$ch
,
CURLOPT_HTTPHEADER
,
$header
);
...
...
@@ -530,4 +545,38 @@ class Yohobuy
}
return
$isMobile
;
}
/**
*根据配置决定请求Java接口的地址
*/
private
static
function
_getUrl
(
$url
,
$param
)
{
if
(
USE_INTER_FACE_SHUNT
===
false
)
{
return
$url
;
}
$uid
=
0
;
$mod
=
0
;
if
(
isset
(
$param
[
'uid'
]))
{
$uid
=
$param
[
'uid'
];
$mod
=
$param
[
'uid'
]
%
1024
;
}
if
(
$mod
>
128
||
$uid
===
0
)
{
if
(
strpos
(
'://api.'
,
$url
))
{
$url
=
array_rand
(
self
::
$interfaceShunt
[
'awsServers'
][
'api'
]);
}
else
if
(
strpos
(
'://service.'
,
$url
))
{
$url
=
array_rand
(
self
::
$interfaceShunt
[
'awsServers'
][
'service'
]);
}
}
else
{
if
(
strpos
(
'://api.'
,
$url
))
{
$url
=
array_rand
(
self
::
$interfaceShunt
[
'tencentServers'
][
'api'
]);
}
else
if
(
strpos
(
'://service.'
,
$url
))
{
$url
=
array_rand
(
self
::
$interfaceShunt
[
'tencentServers'
][
'service'
]);
}
}
return
$url
;
}
}
...
...
yohobuy/www.yohobuy.com/public/index-dev.php
View file @
21f8c54
...
...
@@ -11,6 +11,8 @@ defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'developer');
define
(
'EXHIBITION_TICKET'
,
51335912
);
//展览票skn
define
(
'USE_INTER_FACE_SHUNT'
,
false
);
//分流开关
#test环境
define
(
'API_URL'
,
'http://testapi.yoho.cn:28078/'
);
define
(
'SERVICE_URL'
,
'http://testservice.yoho.cn:28077/'
);
...
...
yohobuy/www.yohobuy.com/public/index-old.php
View file @
21f8c54
...
...
@@ -12,6 +12,8 @@ defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'production');
define
(
'EXHIBITION_TICKET'
,
51335912
);
//展览票skn
define
(
'USE_INTER_FACE_SHUNT'
,
false
);
//分流开关
define
(
'API_URL'
,
'http://api.yoho.yohoops.org/'
);
define
(
'SERVICE_URL'
,
'http://service.yoho.yohoops.org/'
);
define
(
'YOHOBUY_URL'
,
'http://www.yohobuy.com/'
);
...
...
yohobuy/www.yohobuy.com/public/index-pre.php
View file @
21f8c54
...
...
@@ -12,6 +12,8 @@ defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'preview');
define
(
'EXHIBITION_TICKET'
,
51335912
);
//展览票skn
define
(
'USE_INTER_FACE_SHUNT'
,
false
);
//分流开关
define
(
'API_URL'
,
'http://api.yoho.yohoops.org/'
);
define
(
'SERVICE_URL'
,
'http://service.yoho.yohoops.org/'
);
define
(
'YOHOBUY_URL'
,
'http://www.yohobuy.com/'
);
...
...
yohobuy/www.yohobuy.com/public/index-test.php
View file @
21f8c54
...
...
@@ -12,6 +12,8 @@ defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'testing');
define
(
'EXHIBITION_TICKET'
,
51335912
);
//展览票skn
define
(
'USE_INTER_FACE_SHUNT'
,
false
);
//分流开关
define
(
'API_URL'
,
'http://testapi.yoho.cn:28078/'
);
define
(
'SERVICE_URL'
,
'http://testservice.yoho.cn:28077/'
);
define
(
'YOHOBUY_URL'
,
'http://www.yohobuy.com/'
);
...
...
yohobuy/www.yohobuy.com/public/index.php
View file @
21f8c54
...
...
@@ -12,6 +12,8 @@ defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'production');
define
(
'EXHIBITION_TICKET'
,
51335912
);
//展览票skn
define
(
'USE_INTER_FACE_SHUNT'
,
false
);
//分流开关
define
(
'API_URL'
,
'http://api.yoho.yohoops.org/'
);
define
(
'SERVICE_URL'
,
'http://service.yoho.yohoops.org/'
);
define
(
'YOHOBUY_URL'
,
'http://www.yohobuy.com/'
);
...
...
Please
register
or
login
to post a comment