更新
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\model\auth;
|
||||
|
||||
use think\model\concern\SoftDelete;
|
||||
use think\facade\Config;
|
||||
use app\model\BaseModel;
|
||||
|
||||
class Departments extends BaseModel{
|
||||
|
||||
use SoftDelete;
|
||||
protected $deleteTime = 'delete_time';
|
||||
protected $defaultSoftDelete = 0;
|
||||
|
||||
public function scopeAuth($query){
|
||||
$auth = request()->auth();
|
||||
$uid = request()->user['uid'];
|
||||
$map = [];
|
||||
// if(!in_array($uid, Config::get('auth.admin_root'))){
|
||||
// if($auth['data_range'] == 2 || $auth['data_range'] == 3){
|
||||
// $map[] = ['id', '=', $auth['department_id']]; //只能看自己是也只能查自己所在部门
|
||||
// }elseif($auth['data_range'] == 4){
|
||||
// $map[] = ['id', 'IN', getDepartmentChild($auth['department_id'])]; //部门及以下数据
|
||||
// }
|
||||
// }
|
||||
$query->where($map);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user