...
|
...
|
@@ -141,10 +141,10 @@ class Yohobuy |
|
|
$urlBack = $url;
|
|
|
|
|
|
if (USE_INTER_FACE_SHUNT) {
|
|
|
if (strpos($url, API_URL)) {
|
|
|
if (strpos($url, API_URL) !== false) {
|
|
|
$isApi = true;
|
|
|
$url = self::_getUrl($url, $data);
|
|
|
} else if (strpos($url, SERVICE_URL)) {
|
|
|
} else if (strpos($url, SERVICE_URL) !== false) {
|
|
|
$isService = true;
|
|
|
$url = self::_getUrl($url, $data);
|
|
|
}
|
...
|
...
|
@@ -165,7 +165,7 @@ class Yohobuy |
|
|
$url = self::httpBuildQuery($url, $data);
|
|
|
} //echo $url;
|
|
|
|
|
|
UdpLog::debug('get shut api', $url);
|
|
|
//UdpLog::debug('get shut api', $url);
|
|
|
|
|
|
/* 开启缓存的情况 */
|
|
|
if ($cache && USE_CACHE) {
|
...
|
...
|
@@ -194,9 +194,8 @@ class Yohobuy |
|
|
}
|
|
|
$result = curl_exec($ch);
|
|
|
|
|
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
|
//如果分流执行失败,则走原来的逻辑
|
|
|
if (USE_INTER_FACE_SHUNT && $httpCode !== 200) {
|
|
|
if (USE_INTER_FACE_SHUNT && curl_getinfo($ch, CURLINFO_HTTP_CODE) !== 200) {
|
|
|
curl_close($ch);
|
|
|
return self::_get($urlBack, $data, $cache, $returnJson, $timeout, $userAgent, $useGzip);
|
|
|
}
|
...
|
...
|
@@ -293,10 +292,10 @@ class Yohobuy |
|
|
$urlBack = $url;
|
|
|
|
|
|
if (USE_INTER_FACE_SHUNT) {
|
|
|
if (strpos($url, API_URL)) {
|
|
|
if (strpos($url, API_URL) !== false) {
|
|
|
$isApi = true;
|
|
|
$url = self::_getUrl($url, $data);
|
|
|
} else if (strpos($url, SERVICE_URL)) {
|
|
|
} else if (strpos($url, SERVICE_URL) !== false) {
|
|
|
$isService = true;
|
|
|
$url = self::_getUrl($url, $data);
|
|
|
}
|
...
|
...
|
@@ -346,12 +345,8 @@ class Yohobuy |
|
|
}
|
|
|
$result = curl_exec($ch);
|
|
|
|
|
|
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
|
|
|
|
UdpLog::debug('post api', array('url' => $url, 'httpCode' => $httpCode));
|
|
|
|
|
|
//如果分流执行失败,则走原来的逻辑
|
|
|
if (USE_INTER_FACE_SHUNT && $httpCode !== 200) {
|
|
|
if (USE_INTER_FACE_SHUNT && curl_getinfo($ch, CURLINFO_HTTP_CODE) !== 200) {
|
|
|
curl_close($ch);
|
|
|
return self::_post($urlBack, $data, $returnJson, $timeout, $header, $cookie);
|
|
|
}
|
...
|
...
|
@@ -678,11 +673,9 @@ class Yohobuy |
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
UdpLog::debug('read memcache');
|
|
|
$interfaceShunt = Cache::getBy('INTERFACE_SHUT_KEY', 'master');
|
|
|
|
|
|
UdpLog::debug('read memcahe: ', $interfaceShunt);
|
|
|
// UdpLog::debug('read memcahe: ', $interfaceShunt);
|
|
|
if (empty($interfaceShunt)) {
|
|
|
return false;
|
|
|
}
|
...
|
...
|
@@ -731,7 +724,7 @@ class Yohobuy |
|
|
}
|
|
|
|
|
|
$paseUrl = parse_url($url);
|
|
|
if (strpos($url, API_URL)) {
|
|
|
if (strpos($url, API_URL) !== false) {
|
|
|
|
|
|
if (empty($ips['api.yoho.cn'])) {
|
|
|
return false;
|
...
|
...
|
@@ -745,7 +738,7 @@ class Yohobuy |
|
|
|
|
|
$url = 'http://' . $ips['api.yoho.cn'][$num]['ip'] . rtrim($paseUrl['path'], '/') . '/';
|
|
|
|
|
|
} else if (strpos($url, SERVICE_URL)) {
|
|
|
} else if (strpos($url, SERVICE_URL) !== false) {
|
|
|
|
|
|
if (empty($ips['service.yoho.cn'])) {
|
|
|
return false;
|
...
|
...
|
|