Files
sentcms/app/controller/Admin.php
2019-07-10 16:17:51 +08:00

50 lines
1.4 KiB
PHP

<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\controller;
use app\BaseController;
use think\facade\Cache;
/**
* @title 后端公共模块
*/
class Admin extends BaseController {
protected $middleware = [
'\app\middleware\Validate',
'\app\middleware\AdminAuth' => ['except' => ['login']],
'\app\middleware\Admin'
];
protected $data = ['data' => [], 'code' => 0, 'msg' => ''];
protected function initialize(){
$config = Cache::get('system_config');
if (!$config) {
$config = (new \app\model\Config())->lists();
Cache::set('system_config', $config);
}
$this->data['config'] = $config;
}
protected function success($msg, $url){
$this->data['code'] = 0;
$this->data['msg'] = $msg;
$this->data['url'] = $url->__toString();
return $this->data;
}
protected function error($msg, $url){
$this->data['code'] = 1;
$this->data['msg'] = $msg;
$this->data['url'] = $url->__toString();
return $this->data;
}
}