Files
huangjingfen/pro_v3.5.1/app/controller/admin/AuthController.php

80 lines
2.1 KiB
PHP
Raw Normal View History

2026-03-07 22:29:07 +08:00
<?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'] ?? [];
}
}