|
|
|
@ -5,6 +5,7 @@ namespace Home\Controller;
|
|
|
|
|
use Base\Service\PromoteCompanyService;
|
|
|
|
|
use Think\Controller;
|
|
|
|
|
use Base\Service\PromoteService;
|
|
|
|
|
use Base\Tool\Redis;
|
|
|
|
|
|
|
|
|
|
class BaseController extends HomeController
|
|
|
|
|
{
|
|
|
|
@ -30,6 +31,9 @@ class BaseController extends HomeController
|
|
|
|
|
$this->login();
|
|
|
|
|
|
|
|
|
|
$loginer = $this->getLoginPromote();
|
|
|
|
|
|
|
|
|
|
$this->accessLimit($loginer);
|
|
|
|
|
|
|
|
|
|
// $this->certifiCation();
|
|
|
|
|
$pid = is_login_promote();
|
|
|
|
|
define('PLEVEL', $loginer['parent_id']);
|
|
|
|
@ -432,4 +436,20 @@ class BaseController extends HomeController
|
|
|
|
|
->group('relation_game_id')
|
|
|
|
|
->select();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function accessLimit($loginer)
|
|
|
|
|
{
|
|
|
|
|
$urlKey = substr(md5(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME), 8, 16);
|
|
|
|
|
$key = $loginer['id'] . ':' . $urlKey;
|
|
|
|
|
$check = Redis::exists($key);
|
|
|
|
|
if ($check) {
|
|
|
|
|
$count = Redis::incr($key);
|
|
|
|
|
if ($count > 60) {
|
|
|
|
|
die('请求太频繁,请稍后再试!');
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Redis::incr($key);
|
|
|
|
|
Redis::expire($key, 60);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|