|
@@ -12,6 +12,7 @@ use think\Model;
|
|
|
use think\Session;
|
|
|
use fast\Tree;
|
|
|
use think\Validate;
|
|
|
+use think\Db;
|
|
|
|
|
|
/**
|
|
|
* 后台控制器基类
|
|
@@ -230,6 +231,26 @@ class Backend extends Controller
|
|
|
$this->assign('admin', Session::get('admin'));
|
|
|
}
|
|
|
|
|
|
+ protected function whereop($alias = ''){
|
|
|
+
|
|
|
+ $where_op = [];
|
|
|
+
|
|
|
+ $group_id = Db::name('auth_group_access')->where('uid',$this->auth->id)->value('group_id');
|
|
|
+
|
|
|
+ if($group_id == 9){ //分公司
|
|
|
+ $company_ids = Db::name('company')->where('agent_id',$this->auth->id)->column('id');
|
|
|
+ if(!empty($company_ids)){
|
|
|
+ $where_op[$alias.'.id'] = ['IN',$company_ids];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if($group_id == 6 || $group_id == 7){ //老板或员工
|
|
|
+ if($this->auth->company_id){
|
|
|
+ $where_op[$alias.'.id'] = $this->auth->company_id;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $where_op;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 加载语言文件
|
|
|
* @param string $name
|