正在显示
5 个修改的文件
包含
82 行增加
和
35 行删除
| @@ -34,7 +34,7 @@ class AyrReleaseController extends BaseController | @@ -34,7 +34,7 @@ class AyrReleaseController extends BaseController | ||
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | /** | 36 | /** |
| 37 | - * @name :(获取当前用户已绑定的社交链接)info | 37 | + * @name :(获取当前用户已绑定的社交链接) |
| 38 | * @author :lyh | 38 | * @author :lyh |
| 39 | * @method :post | 39 | * @method :post |
| 40 | * @time :2023/5/9 16:00 | 40 | * @time :2023/5/9 16:00 |
| @@ -12,7 +12,7 @@ class DeptUserController extends BaseController | @@ -12,7 +12,7 @@ class DeptUserController extends BaseController | ||
| 12 | { | 12 | { |
| 13 | /** | 13 | /** |
| 14 | * @param ViewDeptUser $viewDeptUser | 14 | * @param ViewDeptUser $viewDeptUser |
| 15 | - * @name :(列表)lists | 15 | + * @name :(部门获取成员列表)lists |
| 16 | * @author :lyh | 16 | * @author :lyh |
| 17 | * @method :post | 17 | * @method :post |
| 18 | * @time :2023/5/17 17:27 | 18 | * @time :2023/5/17 17:27 |
| @@ -23,26 +23,75 @@ class DeptUserController extends BaseController | @@ -23,26 +23,75 @@ class DeptUserController extends BaseController | ||
| 23 | $this->response('success',Code::SUCCESS,$lists); | 23 | $this->response('success',Code::SUCCESS,$lists); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | + | ||
| 26 | /** | 27 | /** |
| 27 | - * @name :(获取成员列表)get_user_list | 28 | + * @param ViewDeptUser $viewDeptUser |
| 29 | + * @name :(详情)info | ||
| 28 | * @author :lyh | 30 | * @author :lyh |
| 29 | * @method :post | 31 | * @method :post |
| 30 | - * @time :2023/5/17 17:38 | 32 | + * @time :2023/5/18 9:32 |
| 31 | */ | 33 | */ |
| 32 | - public function get_user_list(DeptUserLogic $deptUserLogic){ | ||
| 33 | - //获取当前用户已添加的成员 | ||
| 34 | - $list = $deptUserLogic->get_user_list(); | ||
| 35 | - $this->response('success',Code::SUCCESS,$list); | 34 | + public function info(ViewDeptUser $viewDeptUser){ |
| 35 | + $this->request->validate([ | ||
| 36 | + 'id'=>['required'] | ||
| 37 | + ],[ | ||
| 38 | + 'id.required' => 'id不能为空' | ||
| 39 | + ]); | ||
| 40 | + $info = $viewDeptUser->read($this->param); | ||
| 41 | + $this->response('success',Code::SUCCESS,$info); | ||
| 36 | } | 42 | } |
| 43 | + | ||
| 37 | /** | 44 | /** |
| 38 | - * @name :(添加或编辑成员)save | 45 | + * @name :(部门添加用户)add |
| 39 | * @author :lyh | 46 | * @author :lyh |
| 40 | * @method :post | 47 | * @method :post |
| 41 | * @time :2023/5/17 17:36 | 48 | * @time :2023/5/17 17:36 |
| 42 | */ | 49 | */ |
| 43 | public function add(DeptUserLogic $deptUserLogic){ | 50 | public function add(DeptUserLogic $deptUserLogic){ |
| 44 | - $this->param['project_id'] = $this->user['project_id']; | 51 | + $this->request->validate([ |
| 52 | + 'dept_id'=>['required'], | ||
| 53 | + 'user_id'=>['required'] | ||
| 54 | + ],[ | ||
| 55 | + 'dept_id.required' => '组织架构id不能为空', | ||
| 56 | + 'user_id.required' => '用户id不能为空', | ||
| 57 | + ]); | ||
| 45 | $deptUserLogic->dept_user_add(); | 58 | $deptUserLogic->dept_user_add(); |
| 46 | $this->response('success'); | 59 | $this->response('success'); |
| 47 | } | 60 | } |
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * @name :(编辑成员)edit | ||
| 64 | + * @author :lyh | ||
| 65 | + * @method :post | ||
| 66 | + * @time :2023/5/18 9:19 | ||
| 67 | + */ | ||
| 68 | + public function edit(DeptUserLogic $deptUserLogic){ | ||
| 69 | + $this->request->validate([ | ||
| 70 | + 'id'=>['required'], | ||
| 71 | + 'dept_id'=>['required'], | ||
| 72 | + ],[ | ||
| 73 | + 'id.required' => 'id不能为空', | ||
| 74 | + 'dept_id.required' => '组织架构id不能为空', | ||
| 75 | + ]); | ||
| 76 | + $deptUserLogic->dept_user_edit(); | ||
| 77 | + $this->response('success'); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * @name :(设置管理员)set_admin | ||
| 82 | + * @author :lyh | ||
| 83 | + * @method :post | ||
| 84 | + * @time :2023/5/18 10:32 | ||
| 85 | + */ | ||
| 86 | + public function set_admin(DeptUserLogic $deptUserLogic){ | ||
| 87 | + $this->request->validate([ | ||
| 88 | + 'id'=>['required'], | ||
| 89 | + 'is_admin'=>['required'], | ||
| 90 | + ],[ | ||
| 91 | + 'id.required' => 'id不能为空', | ||
| 92 | + 'is_admin.required' => 'is_admin不能为空', | ||
| 93 | + ]); | ||
| 94 | + $deptUserLogic->dept_user_edit(); | ||
| 95 | + $this->response('success'); | ||
| 96 | + } | ||
| 48 | } | 97 | } |
| @@ -17,39 +17,37 @@ class DeptUserLogic extends BaseLogic | @@ -17,39 +17,37 @@ class DeptUserLogic extends BaseLogic | ||
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | /** | 19 | /** |
| 20 | - * @name :(添加用户时获取成员列表)user_list | 20 | + * @name :(部门添加用户)dept_user_add |
| 21 | * @author :lyh | 21 | * @author :lyh |
| 22 | * @method :post | 22 | * @method :post |
| 23 | - * @time :2023/5/17 17:40 | 23 | + * @time :2023/5/18 10:21 |
| 24 | */ | 24 | */ |
| 25 | - public function get_user_list(){ | 25 | + public function dept_user_add(){ |
| 26 | $param = [ | 26 | $param = [ |
| 27 | + 'dept_id'=> $this->param['dept_id'], | ||
| 27 | 'project_id'=>$this->user['project_id'], | 28 | 'project_id'=>$this->user['project_id'], |
| 28 | - 'dept_id'=>$this->param['dept_id'], | 29 | + 'user_id'=>$this->param['user_id'], |
| 30 | + 'operator_id'=>$this->user['id'], | ||
| 31 | + 'create_id'=>$this->user['id'] | ||
| 29 | ]; | 32 | ]; |
| 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 | - } | 33 | + $rs = $this->model->add($param); |
| 34 | + if($rs === false){ | ||
| 35 | + $this->fail('部门添加成员失败'); | ||
| 36 | } | 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); | 37 | + return $this->success(); |
| 44 | } | 38 | } |
| 45 | 39 | ||
| 46 | /** | 40 | /** |
| 47 | - * @name :dept_user_add | 41 | + * @name :(用户更改部门)dept_user_edit |
| 48 | * @author :lyh | 42 | * @author :lyh |
| 49 | * @method :post | 43 | * @method :post |
| 50 | * @time :2023/5/17 17:54 | 44 | * @time :2023/5/17 17:54 |
| 51 | */ | 45 | */ |
| 52 | - public function dept_user_add(){ | ||
| 53 | - | 46 | + public function dept_user_edit(){ |
| 47 | + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 48 | + if($rs === false){ | ||
| 49 | + $this->fail('error'); | ||
| 50 | + } | ||
| 51 | + return $this->success(); | ||
| 54 | } | 52 | } |
| 55 | } | 53 | } |
| @@ -22,7 +22,7 @@ class UserLogic extends BaseLogic | @@ -22,7 +22,7 @@ class UserLogic extends BaseLogic | ||
| 22 | * @method | 22 | * @method |
| 23 | */ | 23 | */ |
| 24 | public function user_info(){ | 24 | public function user_info(){ |
| 25 | - $info = $this->info($this->param); | 25 | + $info = $this->model->read($this->param); |
| 26 | return $this->success($info); | 26 | return $this->success($info); |
| 27 | } | 27 | } |
| 28 | /** | 28 | /** |
| @@ -97,9 +97,9 @@ class UserLogic extends BaseLogic | @@ -97,9 +97,9 @@ class UserLogic extends BaseLogic | ||
| 97 | * @method | 97 | * @method |
| 98 | */ | 98 | */ |
| 99 | public function user_del(){ | 99 | public function user_del(){ |
| 100 | - $ids = $this->param['id']; | ||
| 101 | $this->param['id'] = ['in',$this->param['id']]; | 100 | $this->param['id'] = ['in',$this->param['id']]; |
| 102 | - $this->del($this->param,$ids); | 101 | + $this->model->del($this->param); |
| 102 | + //对应删除组织架构 | ||
| 103 | return $this->success(); | 103 | return $this->success(); |
| 104 | } | 104 | } |
| 105 | 105 |
| @@ -176,9 +176,9 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -176,9 +176,9 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 176 | //组织架构 | 176 | //组织架构 |
| 177 | Route::prefix('user')->group(function () { | 177 | Route::prefix('user')->group(function () { |
| 178 | Route::any('/', [\App\Http\Controllers\Bside\User\DeptUserController::class, 'lists'])->name('dept_user'); | 178 | Route::any('/', [\App\Http\Controllers\Bside\User\DeptUserController::class, 'lists'])->name('dept_user'); |
| 179 | - Route::any('/get_user_list', [\App\Http\Controllers\Bside\User\DeptUserController::class, 'get_user_list'])->name('dept_user_get_user_list'); | 179 | + Route::any('/add', [\App\Http\Controllers\Bside\User\DeptUserController::class, 'add'])->name('dept_user_add'); |
| 180 | Route::any('/info', [\App\Http\Controllers\Bside\User\DeptUserController::class, 'info'])->name('dept_user_info'); | 180 | Route::any('/info', [\App\Http\Controllers\Bside\User\DeptUserController::class, 'info'])->name('dept_user_info'); |
| 181 | - Route::post('/save', [\App\Http\Controllers\Bside\User\DeptUserController::class, 'save'])->name('dept_user_save'); | 181 | + Route::post('/edit', [\App\Http\Controllers\Bside\User\DeptUserController::class, 'edit'])->name('dept_user_edit'); |
| 182 | Route::any('/delete', [\App\Http\Controllers\Bside\User\DeptUserController::class, 'delete'])->name('dept_user_delete'); | 182 | Route::any('/delete', [\App\Http\Controllers\Bside\User\DeptUserController::class, 'delete'])->name('dept_user_delete'); |
| 183 | 183 | ||
| 184 | }); | 184 | }); |
-
请 注册 或 登录 后发表评论