Commit dad76a08 authored by shajiaiming's avatar shajiaiming

fix

parent 1990c78b
......@@ -65,7 +65,7 @@ class IpExceptionController extends Controller
return false;
}
$redis_ticker = \Yii::$app->redis_es;
//$redis_ticker = \Yii::$app->redis_es;
$limit = \Yii::$app->params['api_ip_limit']['limit'];
$white_list = \Yii::$app->params['api_ip_limit']['white_list'];
$ips = '';
......@@ -73,14 +73,17 @@ class IpExceptionController extends Controller
if (in_array($val['key'], $white_list)) continue;
if (!isset($val['request']['buckets'])) continue;
foreach ($val['request']['buckets'] as $b => $item) {
if (strpos($item['key'],'/interface/ticker/hot-ticker') !== false) {
if ($item['doc_count'] > $limit) {
foreach ($val['request']['buckets'] as $bucket) {
$redis_ticker->hmset($val['key'], $bucket['key'], $bucket['doc_count']);
}
$ips .= $val['key'] . ',';
}
if ($item['doc_count'] > $limit) {
$ips .= $val['key'] . ',';
}
// if (strpos($item['key'],'/interface/ticker/hot-ticker') !== false) {
// if ($item['doc_count'] > $limit) {
// foreach ($val['request']['buckets'] as $bucket) {
// $redis_ticker->hmset($val['key'], $bucket['key'], $bucket['doc_count']);
// }
// $ips .= $val['key'] . ',';
// }
// }
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment