12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace Factory\Admin;
- use Dever;
- class Core
- {
- public function __construct()
- {
- $this->user = Dever::load('factory/admin/auth.check');
- $this->id = $this->user['factory_id'];
- $role = explode(',', $this->user['role_id']);
- $uri = Dever::uri();
- $this->user['msg_type'] = false;
- if (!in_array(1, $role)) {
- $this->user['msg_type'] = array(1,2,6);
- if (!in_array(2, $role)) {
- unset($this->user['msg_type'][1]);
- if (strstr($uri, 'order')) {
- echo '您没有权限';die;
- }
- }
- if (!in_array(4, $role)) {
- unset($this->user['msg_type'][2]);
- if (strstr($uri, 'stat')) {
- echo '您没有权限';die;
- }
- }
- if (strstr($uri, 'set')) {
- echo '您没有权限';die;
- }
- if (strstr($uri, 'user')) {
- echo '您没有权限';die;
- }
- $this->user['msg_type'] = implode(',', $this->user['msg_type']);
- }
- $this->info = Dever::db('factory/info')->find($this->id);
- if (!$this->info) {
- echo '工厂不存在';die;
- }
- if ($this->info['status'] != 1) {
- if (!strstr($uri, 'set') && !strstr($uri, 'help') && !strstr($uri, 'console')) {
- echo '认证中或者认证失败无法访问该功能';die;
- }
- }
- }
- }
|