|
|
@@ -2,6 +2,7 @@ |
|
|
|
|
|
|
|
namespace app\admin\controller\auth; |
|
|
|
|
|
|
|
use app\admin\dao\GroupDao; |
|
|
|
use app\admin\model\AuthGroup; |
|
|
|
use app\admin\model\AuthGroupAccess; |
|
|
|
use app\common\controller\Backend; |
|
|
@@ -300,12 +301,26 @@ class Admin extends Backend |
|
|
|
$name=$this->request->post('name'); |
|
|
|
$keyValue=$this->request->post('keyValue'); |
|
|
|
$this->model->field('id,nickname as name'); |
|
|
|
$groupDao = new GroupDao(); |
|
|
|
$groupIds = $groupDao->getSubGroup($this->auth->getGroupId()); |
|
|
|
//获取用户ID |
|
|
|
$accModel = new AuthGroupAccess(); |
|
|
|
$accList = $accModel->where(["group_id" => ["in",$groupIds]])->select(); |
|
|
|
if ($accList == null) { |
|
|
|
return json(['list' => []]); |
|
|
|
} |
|
|
|
$accList = $accList->toArray(); |
|
|
|
$ids = []; |
|
|
|
foreach ($accList as $acc) { |
|
|
|
$ids[] = $acc['uid']; |
|
|
|
} |
|
|
|
$where = ["id"=>["in",$ids]]; |
|
|
|
if($keyValue){ |
|
|
|
$this->model->where(['id'=>$keyValue]); |
|
|
|
$where = ['id'=>$keyValue]; |
|
|
|
}elseif($name){ |
|
|
|
$this->model->where(['nickname'=>['like','%'.$name.'%']]); |
|
|
|
$where = ['nickname'=>['like','%'.$name.'%'],"id"=>["in",$ids]]; |
|
|
|
} |
|
|
|
$result= $this->model->select(); |
|
|
|
$result= $this->model->where($where)->select(); |
|
|
|
// print_r($result); |
|
|
|
if($keyValue){ |
|
|
|
return json(['list' => $result]); |
|
|
|