mirror of https://gitee.com/karson/fastadmin.git
35 lines
889 B
PHP
35 lines
889 B
PHP
<?php
|
|
/**
|
|
* @desc: 获取管理员能管理的站点
|
|
* @Author: Dr.Xing <ezfwork@foxmail.com>
|
|
* @Since: 2018/2/1 21:43
|
|
*/
|
|
|
|
namespace seven\behavior;
|
|
|
|
use think\Session;
|
|
|
|
class GetSiteId
|
|
{
|
|
public function run()
|
|
{
|
|
$siteId = request()->param('user_site_id');
|
|
if(!is_null($siteId)) {
|
|
Session::set("user_site_id", $siteId);
|
|
return;
|
|
}
|
|
$auth =\app\admin\library\Auth::instance();
|
|
if($auth->isSuperAdmin()){
|
|
Session::delete("user_site_id");
|
|
return;
|
|
}
|
|
$user = $auth->getUserInfo();
|
|
$site = \app\common\model\Sites::get(['user_id'=>$user['id']]); //\think\Db::name('sites')->where('user_id', $user['id'])->find();
|
|
if($site!=false) {
|
|
Session::set("user_site_id", $site['id']);
|
|
}else{
|
|
Session::set("user_site_id", -1);
|
|
}
|
|
}
|
|
|
|
} |