系统设置初始化

This commit is contained in:
2020-04-19 10:20:43 +08:00
parent 99a93a65aa
commit 35ba9110d3
3 changed files with 17 additions and 19 deletions

View File

@@ -12,10 +12,11 @@ use app\model\Menu;
use app\model\Model;
use app\model\AuthGroup;
use app\model\Addons;
use think\facade\View;
use \app\model\Form;
use \app\controller\Base as BaseC;
use app\model\Form;
use app\controller\Base as BaseC;
use think\facade\Cache;
use think\facade\Route;
use think\facade\View;
class Base extends BaseC {
@@ -47,9 +48,9 @@ class Base extends BaseC {
// 是否是超级管理员
define('IS_ROOT', is_administrator());
if (!IS_ROOT && \think\facade\Config::get('config.admin_allow_ip')) {
if (!IS_ROOT && $this->config['admin_allow_ip']) {
// 检查IP地址访问
if (!in_array(get_client_ip(), explode(',', \think\facade\Config::get('config.admin_allow_ip')))) {
if (!in_array(get_client_ip(), explode(',', $this->config['admin_allow_ip']))) {
$this->error('403:禁止访问');
}
}
@@ -129,8 +130,8 @@ class Base extends BaseC {
* @author 朱亚杰 <xcoolcc@gmail.com>
*/
final protected function accessControl() {
$allow = \think\facade\Config::get('allow_visit');
$deny = \think\facade\Config::get('deny_visit');
$allow = $this->config['allow_visit'];
$deny = $this->config['deny_visit'];
$check = strtolower($this->request->controller() . '/' . $this->request->action());
if (!empty($deny) && in_array_case($check, $deny)) {
return false; //非超管禁止访问deny中的方法