master
ELF 4 years ago
parent 006aefd39c
commit 8da0b1b4b7

@ -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