1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace store\Admin;
- use Dever;
- class Core
- {
- public function __construct()
- {
- $this->user = Dever::load('store/admin/auth.check');
- $this->id = $this->user['store_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,7);
- if (!in_array(2, $role)) {
- unset($this->user['msg_type'][1]);
- if ($uri == 'order' || strstr($uri, 'admin/order') || strstr($uri, 'order_')) {
- echo '您没有权限';die;
- }
- }
- if (!in_array(4, $role)) {
- unset($this->user['msg_type'][2]);
- if (strstr($uri, 'stat')) {
- echo '您没有权限';die;
- }
- }
- if (!in_array(3, $role)) {
- unset($this->user['msg_type'][3]);
- if (strstr($uri, 'factory_order') || strstr($uri, 'goods') || strstr($uri, 'out')) {
- 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('store/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;
- }
- }
- }
- }
|