Files
huangjingfen/pro_v3.5.1/app/controller/admin/AuthController.php
panchengyong 7acbf45ff7 new files
2026-03-07 22:29:07 +08:00

80 lines
2.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\admin;
use app\Request;
use crmeb\basic\BaseController;
use think\Response;
/**
* 基类 所有控制器继承的类
* Class AuthController
* @package app\controller\admin
* @property Request $request
* @method Response success($message = '', array $data = [])
* @method Response fail($message = '', array $data = [])
*/
class AuthController extends BaseController
{
/**
* 当前登陆管理员信息
* @var array
*/
protected $adminInfo = [];
/**
* 当前登陆管理员ID
* @var int
*/
protected $adminId = 0;
protected $supplierId = 0;
/**
* 当前登陆管理员类型 4 是供应商
* @var int
*/
protected $adminType = 1;
/**
* 当前管理员权限
* @var array
*/
protected $auth = [];
/**
* 初始化
*/
protected function initialize()
{
$this->loadAdminInfo();
}
/**
* 加载管理员信息
*/
protected function loadAdminInfo()
{
$this->adminId = $this->request->hasMacro('adminId') ? (int)$this->request->adminId() : 0;
$this->adminInfo = $this->request->hasMacro('adminInfo') ? (array)$this->request->adminInfo() : [];
$this->adminType = $this->adminInfo['admin_type'] ?? 1;
if ($this->adminType == 4) {
$this->supplierId = $this->adminId;
}
$this->auth = $this->adminInfo['rule'] ?? [];
}
}