正在显示
5 个修改的文件
包含
126 行增加
和
0 行删除
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Bside\User; | ||
| 4 | + | ||
| 5 | +use App\Enums\Common\Code; | ||
| 6 | +use App\Http\Controllers\Bside\BaseController; | ||
| 7 | +use App\Http\Logic\Bside\User\DeptUserLogic; | ||
| 8 | +use App\Models\User\DeptUser; | ||
| 9 | +use App\Models\User\ViewDeptUser; | ||
| 10 | + | ||
| 11 | +class DeptUserController extends BaseController | ||
| 12 | +{ | ||
| 13 | + /** | ||
| 14 | + * @param ViewDeptUser $viewDeptUser | ||
| 15 | + * @name :(列表)lists | ||
| 16 | + * @author :lyh | ||
| 17 | + * @method :post | ||
| 18 | + * @time :2023/5/17 17:27 | ||
| 19 | + */ | ||
| 20 | + public function lists(ViewDeptUser $viewDeptUser){ | ||
| 21 | + $this->param['project_id'] = $this->user['project_id']; | ||
| 22 | + $lists = $viewDeptUser->lists($this->map,$this->page,$this->row,$this->order); | ||
| 23 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * @name :(获取成员列表)get_user_list | ||
| 28 | + * @author :lyh | ||
| 29 | + * @method :post | ||
| 30 | + * @time :2023/5/17 17:38 | ||
| 31 | + */ | ||
| 32 | + public function get_user_list(DeptUserLogic $deptUserLogic){ | ||
| 33 | + //获取当前用户已添加的成员 | ||
| 34 | + $list = $deptUserLogic->get_user_list(); | ||
| 35 | + $this->response('success',Code::SUCCESS,$list); | ||
| 36 | + } | ||
| 37 | + /** | ||
| 38 | + * @name :(添加或编辑成员)save | ||
| 39 | + * @author :lyh | ||
| 40 | + * @method :post | ||
| 41 | + * @time :2023/5/17 17:36 | ||
| 42 | + */ | ||
| 43 | + public function add(DeptUserLogic $deptUserLogic){ | ||
| 44 | + $this->param['project_id'] = $this->user['project_id']; | ||
| 45 | + } | ||
| 46 | +} |
app/Http/Logic/Bside/User/DeptUserLogic.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Bside\User; | ||
| 4 | + | ||
| 5 | +use App\Http\Logic\Bside\BaseLogic; | ||
| 6 | +use App\Models\User\DeptUser; | ||
| 7 | +use App\Models\User\User; | ||
| 8 | + | ||
| 9 | +class DeptUserLogic extends BaseLogic | ||
| 10 | +{ | ||
| 11 | + public function __construct() | ||
| 12 | + { | ||
| 13 | + parent::__construct(); | ||
| 14 | + | ||
| 15 | + $this->model = new DeptUser(); | ||
| 16 | + $this->param = $this->requestAll; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * @name :(添加用户时获取成员列表)user_list | ||
| 21 | + * @author :lyh | ||
| 22 | + * @method :post | ||
| 23 | + * @time :2023/5/17 17:40 | ||
| 24 | + */ | ||
| 25 | + public function get_user_list(){ | ||
| 26 | + $param = [ | ||
| 27 | + 'project_id'=>$this->user['project_id'], | ||
| 28 | + 'dept_id'=>$this->param['dept_id'], | ||
| 29 | + ]; | ||
| 30 | + $dept_list = $this->model->list($param,'id'); | ||
| 31 | + if(!empty($dept_list)){ | ||
| 32 | + $arr = []; | ||
| 33 | + foreach ($dept_list as $k => $v){ | ||
| 34 | + $arr[] = $v['user_id']; | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + $userModel = new User(); | ||
| 38 | + $param = [ | ||
| 39 | + 'project_id'=>$this->user['project_id'], | ||
| 40 | + 'id'=>['not in',$arr], | ||
| 41 | + ]; | ||
| 42 | + $list = $userModel->list($param,'id',['id','name','email','mobile','created_at']); | ||
| 43 | + return $this->success($list); | ||
| 44 | + } | ||
| 45 | +} |
app/Models/User/DeptUser.php
0 → 100644
app/Models/User/ProjectDept.php
0 → 100644
-
请 注册 或 登录 后发表评论