正在显示
6 个修改的文件
包含
244 行增加
和
4 行删除
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :MenuSpecialController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/8/7 11:51 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Aside\Manage; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Controllers\Aside\BaseController; | ||
| 14 | +use App\Http\Logic\Aside\Manage\MenuSpecialLogic; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * @remark :特殊模块设置 | ||
| 18 | + * @name :MenuSpecialController | ||
| 19 | + * @author :lyh | ||
| 20 | + * @method :post | ||
| 21 | + * @time :2023/8/7 11:51 | ||
| 22 | + */ | ||
| 23 | +class MenuSpecialController extends BaseController | ||
| 24 | +{ | ||
| 25 | + /** | ||
| 26 | + * @remark :特殊模块列表 | ||
| 27 | + * @name :lists | ||
| 28 | + * @author :lyh | ||
| 29 | + * @method :post | ||
| 30 | + * @time :2023/8/7 11:52 | ||
| 31 | + */ | ||
| 32 | + public function lists(MenuSpecialLogic $logic){ | ||
| 33 | + $lists = $logic->specialLists($this->map,$this->page,$this->row,$this->order); | ||
| 34 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * @remark :详情 | ||
| 39 | + * @name :info | ||
| 40 | + * @author :lyh | ||
| 41 | + * @method :post | ||
| 42 | + * @time :2023/8/7 14:31 | ||
| 43 | + */ | ||
| 44 | + public function info(MenuSpecialLogic $logic){ | ||
| 45 | + $this->request->validate([ | ||
| 46 | + 'id'=>'required' | ||
| 47 | + ],[ | ||
| 48 | + 'id.required' => 'ID不能为空' | ||
| 49 | + ]); | ||
| 50 | + $info = $logic->specialInfo(); | ||
| 51 | + $this->response('success',Code::SUCCESS,$info); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * @remark :添加时获取用户列表 | ||
| 56 | + * @name :managerList | ||
| 57 | + * @author :lyh | ||
| 58 | + * @method :post | ||
| 59 | + * @time :2023/8/7 14:31 | ||
| 60 | + */ | ||
| 61 | + public function getManagerList(MenuSpecialLogic $logic){ | ||
| 62 | + $list = $logic->managerList(); | ||
| 63 | + $this->response('success',Code::SUCCESS,$list); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * @remark :保存特殊模块 | ||
| 68 | + * @name :save | ||
| 69 | + * @author :lyh | ||
| 70 | + * @method :post | ||
| 71 | + * @time :2023/8/7 11:54 | ||
| 72 | + */ | ||
| 73 | + public function save(MenuSpecialLogic $logic){ | ||
| 74 | + $this->request->validate([ | ||
| 75 | + 'name'=>'required', | ||
| 76 | + 'user_list'=>'required', | ||
| 77 | + 'remark'=>'required' | ||
| 78 | + ],[ | ||
| 79 | + 'name.required' => 'name不能为空', | ||
| 80 | + 'user_list.required' => 'user_list不能为空', | ||
| 81 | + 'remark.required' => 'remark不能为空' | ||
| 82 | + ]); | ||
| 83 | + $logic->specialSave(); | ||
| 84 | + $this->response('success'); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * @remark :删除特殊模块 | ||
| 89 | + * @name :del | ||
| 90 | + * @author :lyh | ||
| 91 | + * @method :post | ||
| 92 | + * @time :2023/8/7 11:54 | ||
| 93 | + */ | ||
| 94 | + public function del(MenuSpecialLogic $logic){ | ||
| 95 | + $this->request->validate([ | ||
| 96 | + 'id'=>'required' | ||
| 97 | + ],[ | ||
| 98 | + 'id.required' => 'ID不能为空' | ||
| 99 | + ]); | ||
| 100 | + $logic->specialDel(); | ||
| 101 | + $this->response('success'); | ||
| 102 | + } | ||
| 103 | +} |
| @@ -6,8 +6,6 @@ use App\Enums\Common\Code; | @@ -6,8 +6,6 @@ use App\Enums\Common\Code; | ||
| 6 | use App\Http\Controllers\Aside\BaseController; | 6 | use App\Http\Controllers\Aside\BaseController; |
| 7 | use App\Http\Logic\Aside\User\UserLogic; | 7 | use App\Http\Logic\Aside\User\UserLogic; |
| 8 | use App\Http\Requests\Aside\User\UserRequest; | 8 | use App\Http\Requests\Aside\User\UserRequest; |
| 9 | -use App\Models\Manage\Manage; | ||
| 10 | -use App\Models\Project\Project; | ||
| 11 | use App\Models\User\User; | 9 | use App\Models\User\User; |
| 12 | use App\Models\User\User as UserModel; | 10 | use App\Models\User\User as UserModel; |
| 13 | 11 |
| @@ -76,7 +76,6 @@ class ComController extends BaseController | @@ -76,7 +76,6 @@ class ComController extends BaseController | ||
| 76 | */ | 76 | */ |
| 77 | public function get_menu(){ | 77 | public function get_menu(){ |
| 78 | //根据当前登录用户角色返回用户菜单列表 | 78 | //根据当前登录用户角色返回用户菜单列表 |
| 79 | - | ||
| 80 | $projectMenuModel = new ProjectMenuModel(); | 79 | $projectMenuModel = new ProjectMenuModel(); |
| 81 | if($this->user['role_id'] != 0){ | 80 | if($this->user['role_id'] != 0){ |
| 82 | $projectRoleModel = new ProjectRoleModel(); | 81 | $projectRoleModel = new ProjectRoleModel(); |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :MenuSpecialLogic.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/8/7 11:56 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Logic\Aside\Manage; | ||
| 11 | + | ||
| 12 | +use App\Http\Logic\Aside\BaseLogic; | ||
| 13 | +use App\Models\Manage\Manage; | ||
| 14 | +use App\Models\Manage\MenuSpecial; | ||
| 15 | + | ||
| 16 | +class MenuSpecialLogic extends BaseLogic | ||
| 17 | +{ | ||
| 18 | + public function __construct() | ||
| 19 | + { | ||
| 20 | + parent::__construct(); | ||
| 21 | + $this->param = $this->requestAll; | ||
| 22 | + $this->model = new MenuSpecial(); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * @remark :列表 | ||
| 27 | + * @name :lists | ||
| 28 | + * @author :lyh | ||
| 29 | + * @method :post | ||
| 30 | + * @time :2023/8/7 13:44 | ||
| 31 | + */ | ||
| 32 | + public function specialLists($map,$page,$row,$order,$filed = ['*']){ | ||
| 33 | + $lists = $this->model->lists($map,$page,$row,$order,$filed); | ||
| 34 | + return $this->success($lists); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * @remark :添加时获取用户列表 | ||
| 39 | + * @name :managerList | ||
| 40 | + * @author :lyh | ||
| 41 | + * @method :post | ||
| 42 | + * @time :2023/8/7 14:33 | ||
| 43 | + */ | ||
| 44 | + public function managerList($map){ | ||
| 45 | + $managerModel = new Manage(); | ||
| 46 | + $list = $managerModel->list($map); | ||
| 47 | + return $this->success($list); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * @remark :获取详情 | ||
| 52 | + * @name :specialInfo | ||
| 53 | + * @author :lyh | ||
| 54 | + * @method :post | ||
| 55 | + * @time :2023/8/7 14:15 | ||
| 56 | + */ | ||
| 57 | + public function specialInfo(){ | ||
| 58 | + $info = $this->model->read($this->param); | ||
| 59 | + if($info === false){ | ||
| 60 | + $this->fail('当前数据不存在或者被删除'); | ||
| 61 | + } | ||
| 62 | + $info['manager_list'] = $this->manager_list($info['user_list']); | ||
| 63 | + return $this->success($info); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * @remark :获取所有用户名称 | ||
| 68 | + * @name :manager_list | ||
| 69 | + * @author :lyh | ||
| 70 | + * @method :post | ||
| 71 | + * @time :2023/8/7 14:17 | ||
| 72 | + */ | ||
| 73 | + public function manager_list($manager_id){ | ||
| 74 | + $managerModel = new Manage(); | ||
| 75 | + $list = $managerModel->list(['id'=>['in',explode(',',trim($manager_id,','))]]); | ||
| 76 | + $str = ''; | ||
| 77 | + foreach ($list as $k => $v){ | ||
| 78 | + $str .= $v['name'].','; | ||
| 79 | + } | ||
| 80 | + return trim($str,','); | ||
| 81 | + } | ||
| 82 | + /** | ||
| 83 | + * @remark :保存 | ||
| 84 | + * @name :specialSave | ||
| 85 | + * @author :lyh | ||
| 86 | + * @method :post | ||
| 87 | + * @time :2023/8/7 13:52 | ||
| 88 | + */ | ||
| 89 | + public function specialSave(){ | ||
| 90 | + $this->param['user_list'] = ','.trim($this->param['user_list'],',').','; | ||
| 91 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 92 | + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 93 | + }else{ | ||
| 94 | + $rs = $this->model->add($this->param); | ||
| 95 | + } | ||
| 96 | + if($rs === false){ | ||
| 97 | + $this->fail('error'); | ||
| 98 | + } | ||
| 99 | + return $this->success(); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + /** | ||
| 103 | + * @remark :删除 | ||
| 104 | + * @name :specialDel | ||
| 105 | + * @author :lyh | ||
| 106 | + * @method :post | ||
| 107 | + * @time :2023/8/7 13:52 | ||
| 108 | + */ | ||
| 109 | + public function specialDel(){ | ||
| 110 | + $rs = $this->model->del($this->param); | ||
| 111 | + if($rs === false){ | ||
| 112 | + $this->fail('error'); | ||
| 113 | + } | ||
| 114 | + return $this->success(); | ||
| 115 | + } | ||
| 116 | +} |
app/Models/Manage/MenuSpecial.php
0 → 100644
| @@ -60,7 +60,14 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -60,7 +60,14 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 60 | //发送记录 | 60 | //发送记录 |
| 61 | Route::any('/log', [Aside\Ai\AiLogController::class, 'lists'])->name('admin.lists'); | 61 | Route::any('/log', [Aside\Ai\AiLogController::class, 'lists'])->name('admin.lists'); |
| 62 | }); | 62 | }); |
| 63 | - | 63 | + //特殊模块权限设置 |
| 64 | + Route::prefix('special')->group(function () { | ||
| 65 | + Route::any('/', [Aside\Manage\MenuSpecialController::class, 'lists'])->name('admin.Special_lists'); | ||
| 66 | + Route::any('/info', [Aside\Manage\MenuSpecialController::class, 'info'])->name('admin.Special_info'); | ||
| 67 | + Route::any('/save', [Aside\Manage\MenuSpecialController::class, 'save'])->name('admin.Special_save'); | ||
| 68 | + Route::any('/del', [Aside\Manage\MenuSpecialController::class, 'del'])->name('admin.Special_del'); | ||
| 69 | + Route::any('/getManagerList', [Aside\Manage\MenuSpecialController::class, 'getManagerList'])->name('admin.Special_getManagerList'); | ||
| 70 | + }); | ||
| 64 | //站内信 | 71 | //站内信 |
| 65 | Route::prefix('mail')->group(function () { | 72 | Route::prefix('mail')->group(function () { |
| 66 | Route::any('/', [Aside\Mail\MailController::class, 'lists'])->name('admin.mail_lists'); | 73 | Route::any('/', [Aside\Mail\MailController::class, 'lists'])->name('admin.mail_lists'); |
-
请 注册 或 登录 后发表评论