Merge pull request '有害' (#318) from hotfix/promote_access_limit into master

Reviewed-on: http://8.136.139.249:3000/wmtx/platform/pulls/318
master
廖金灵 4 years ago
commit f4d2e06801

@ -442,14 +442,19 @@ class BaseController extends HomeController
{
$url = MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME;
$urlKey = substr(md5($url), 8, 16);
$key = $loginer['id'] . ':' . $urlKey;
$key = 'promote_access_limit:' . $loginer['id'] . ':' . $urlKey;
$check = Redis::exists($key);
if ($check) {
$count = Redis::incr($key);
if ($count > 60) {
Log::write('user_access_limit:' . date('Y-m-d H:i:s') . ' ' . $key . '[' . $url . ']', 'INFO');
$this->assign("ttl",Redis::ttl($key));
$this->display("Index/accessLimit");
Log::write('promote_access_limit:' . date('Y-m-d H:i:s') . ' ' . $key . '[' . $url . ']', 'INFO');
$ttl = Redis::ttl($key);
if ($ttl == -1) {
Redis::incr($key);
Redis::expire($key, 60);
}
$this->assign('ttl', $ttl);
$this->display('Index/accessLimit');
die();
}
} else {

Loading…
Cancel
Save