123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace app\admin\controller;
- use think\Db;
- class Auth extends Base
- {
- public $userId;
- public $orgId;
- public $rolesId;
- protected function initialize()
- {
- if(!is_login()){
- if(request()->isAjax()){
- $this->error('未登录,请先登录');
- }else{
- $this->redirect(url('common/login'));
- }
- }
- $this->userId = is_login();
- $this->orgId = cur_org_id();
- $user = session('user_auth');
- $this->rolesId = !empty($user)&&isset($user['rolesId'])?$user['rolesId']:0;
- $this->assign('rolesId',$this->rolesId);
- // 检查是否有紧急事件
- $info = Db::name('burst_record')
- ->where('user_id',$this->userId)
- ->where('status',1)
- ->where('del',0)
- ->find();
- if($info){
- $this->redirect(url('Bursting/index'));
- }
- parent::initialize();
- }
- public function getTableField($table,$where,$field){
- $val = Db::name($table)
- ->where($where)
- ->value($field);
- return $val;
- }
- }
|