正在显示
7 个修改的文件
包含
323 行增加
和
5 行删除
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :ProjectMenuSeoController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/3/4 15:28 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Aside\User; | ||
| 11 | + | ||
| 12 | +use App\Http\Controllers\Aside\BaseController; | ||
| 13 | +use App\Http\Logic\Aside\User\ProjectMenuSeoLogic; | ||
| 14 | +use App\Models\User\ProjectMenuSeo; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * @remark :设置白帽菜单 | ||
| 18 | + * @name :ProjectMenuSeoController | ||
| 19 | + * @author :lyh | ||
| 20 | + * @method :post | ||
| 21 | + * @time :2025/3/4 15:28 | ||
| 22 | + */ | ||
| 23 | +class ProjectMenuSeoController extends BaseController | ||
| 24 | +{ | ||
| 25 | + /** | ||
| 26 | + * @remark :白帽菜单列表 | ||
| 27 | + * @name :lists | ||
| 28 | + * @author :lyh | ||
| 29 | + * @method :post | ||
| 30 | + * @time :2025/3/4 15:33 | ||
| 31 | + */ | ||
| 32 | + public function lists(ProjectMenuSeo $projectMenuSeo){ | ||
| 33 | + $lists = $projectMenuSeo->list($this->map,'sort'); | ||
| 34 | + $menu = array(); | ||
| 35 | + foreach ($lists as $k => $v){ | ||
| 36 | + $v = (array)$v; | ||
| 37 | + if ($v['pid'] == 0) { | ||
| 38 | + $v['sub'] = _get_child($v['id'], $lists); | ||
| 39 | + $menu[] = $v; | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + $this->response('success',Code::SUCCESS,$menu); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * @remark :获取白帽详情 | ||
| 47 | + * @name :info | ||
| 48 | + * @author :lyh | ||
| 49 | + * @method :post | ||
| 50 | + * @time :2025/3/4 15:34 | ||
| 51 | + */ | ||
| 52 | + public function info(ProjectMenuSeo $projectMenuSeo){ | ||
| 53 | + $this->request->validate([ | ||
| 54 | + 'id'=>'required' | ||
| 55 | + ],[ | ||
| 56 | + 'id.required' => 'ID不能为空' | ||
| 57 | + ]); | ||
| 58 | + $info = $projectMenuSeo->read($this->param); | ||
| 59 | + $this->response('success',Code::SUCCESS,$info); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * @remark :添加菜单 | ||
| 64 | + * @name :add | ||
| 65 | + * @author :lyh | ||
| 66 | + * @method :post | ||
| 67 | + * @time :2025/3/4 15:38 | ||
| 68 | + */ | ||
| 69 | + public function add(ProjectMenuSeoLogic $projectMenuSeoLogic){ | ||
| 70 | + $this->request->validate([ | ||
| 71 | + 'name'=>'required' | ||
| 72 | + ],[ | ||
| 73 | + 'name.required' => '名称不能为空' | ||
| 74 | + ]); | ||
| 75 | + $projectMenuSeoLogic->menu_add(); | ||
| 76 | + $this->response('success'); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * @remark :编辑菜单 | ||
| 81 | + * @name :edit | ||
| 82 | + * @author :lyh | ||
| 83 | + * @method :post | ||
| 84 | + * @time :2025/3/4 15:42 | ||
| 85 | + */ | ||
| 86 | + public function edit(ProjectMenuSeoLogic $projectMenuSeoLogic){ | ||
| 87 | + $this->request->validate([ | ||
| 88 | + 'name'=>'required' | ||
| 89 | + ],[ | ||
| 90 | + 'name.required' => '名称不能为空' | ||
| 91 | + ]); | ||
| 92 | + $projectMenuSeoLogic->menu_edit(); | ||
| 93 | + $this->response('success'); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + /** | ||
| 97 | + * @remark :删除菜单 | ||
| 98 | + * @name :del | ||
| 99 | + * @author :lyh | ||
| 100 | + * @method :post | ||
| 101 | + * @time :2025/3/4 15:43 | ||
| 102 | + */ | ||
| 103 | + public function del(ProjectMenuSeoLogic $projectMenuSeoLogic){ | ||
| 104 | + $this->request->validate([ | ||
| 105 | + 'id'=>['required','array'], | ||
| 106 | + ],[ | ||
| 107 | + 'id.required' => 'ID不能为空', | ||
| 108 | + 'id.array' => 'ID为数组', | ||
| 109 | + ]); | ||
| 110 | + $projectMenuSeoLogic->menu_del(); | ||
| 111 | + $this->response('success'); | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + /** | ||
| 115 | + * @remark :获取子菜单 | ||
| 116 | + * @name :getSonMenu | ||
| 117 | + * @author :lyh | ||
| 118 | + * @method :post | ||
| 119 | + * @time :2023/8/3 14:19 | ||
| 120 | + */ | ||
| 121 | + public function getSonMenu(ProjectMenuSeoLogic $projectMenuSeoLogic){ | ||
| 122 | + $list = $projectMenuSeoLogic->roleMenuInfo(); | ||
| 123 | + $this->response('success',Code::SUCCESS,$list); | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + /** | ||
| 127 | + * @remark :排序 | ||
| 128 | + * @name :setSort | ||
| 129 | + * @author :lyh | ||
| 130 | + * @method :post | ||
| 131 | + * @time :2023/8/10 16:40 | ||
| 132 | + */ | ||
| 133 | + public function sort(ProjectMenuSeoLogic $projectMenuSeoLogic){ | ||
| 134 | + $this->request->validate([ | ||
| 135 | + 'id'=>'required', | ||
| 136 | + ],[ | ||
| 137 | + 'id.required' => 'ID不能为空', | ||
| 138 | + ]); | ||
| 139 | + $projectMenuSeoLogic->setParamStatus(); | ||
| 140 | + $this->response('success'); | ||
| 141 | + } | ||
| 142 | +} |
| @@ -13,9 +13,9 @@ use App\Models\Project\DeployBuild; | @@ -13,9 +13,9 @@ use App\Models\Project\DeployBuild; | ||
| 13 | use App\Models\Project\Project; | 13 | use App\Models\Project\Project; |
| 14 | use App\Models\RouteMap\RouteMap; | 14 | use App\Models\RouteMap\RouteMap; |
| 15 | use App\Models\User\ProjectMenu as ProjectMenuModel; | 15 | use App\Models\User\ProjectMenu as ProjectMenuModel; |
| 16 | +use App\Models\User\ProjectMenuSeo; | ||
| 16 | use App\Models\User\ProjectRole as ProjectRoleModel; | 17 | use App\Models\User\ProjectRole as ProjectRoleModel; |
| 17 | use App\Models\User\User; | 18 | use App\Models\User\User; |
| 18 | -use Illuminate\Support\Facades\Artisan; | ||
| 19 | use Illuminate\Support\Facades\Cache; | 19 | use Illuminate\Support\Facades\Cache; |
| 20 | 20 | ||
| 21 | /*** | 21 | /*** |
| @@ -36,9 +36,7 @@ class ComController extends BaseController | @@ -36,9 +36,7 @@ class ComController extends BaseController | ||
| 36 | }else{ | 36 | }else{ |
| 37 | $this->map = $this->getAdminMenuCondition(); | 37 | $this->map = $this->getAdminMenuCondition(); |
| 38 | } | 38 | } |
| 39 | - if(!isset($this->map['type'])){//默认获取6.0菜单 | ||
| 40 | - $this->map['type'] = 0; | ||
| 41 | - } | 39 | + $this->map['type'] = 0; |
| 42 | $lists = $projectMenuModel->list($this->map,'sort'); | 40 | $lists = $projectMenuModel->list($this->map,'sort'); |
| 43 | $menu = array(); | 41 | $menu = array(); |
| 44 | foreach ($lists as $k => $v){ | 42 | foreach ($lists as $k => $v){ |
| @@ -52,6 +50,27 @@ class ComController extends BaseController | @@ -52,6 +50,27 @@ class ComController extends BaseController | ||
| 52 | } | 50 | } |
| 53 | 51 | ||
| 54 | /** | 52 | /** |
| 53 | + * @remark :白帽seo获取菜单 | ||
| 54 | + * @name :seo_get_menu | ||
| 55 | + * @author :lyh | ||
| 56 | + * @method :post | ||
| 57 | + * @time :2025/3/4 14:48 | ||
| 58 | + */ | ||
| 59 | + public function seo_get_menu(){ | ||
| 60 | + $seoMenuModel = new ProjectMenuSeo(); | ||
| 61 | + $lists = $seoMenuModel->list($this->map,'sort'); | ||
| 62 | + $menu = array(); | ||
| 63 | + foreach ($lists as $k => $v){ | ||
| 64 | + $v = (array)$v; | ||
| 65 | + if ($v['pid'] == 0) { | ||
| 66 | + $v['sub'] = _get_child($v['id'], $lists); | ||
| 67 | + $menu[] = $v; | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + $this->response('当前用户菜单列表',Code::SUCCESS,$menu); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + /** | ||
| 55 | * @remark :获取当前菜单的自定义模块 | 74 | * @remark :获取当前菜单的自定义模块 |
| 56 | * @name :getProjectCustomMenu | 75 | * @name :getProjectCustomMenu |
| 57 | * @author :lyh | 76 | * @author :lyh |
| @@ -79,6 +79,7 @@ class AiCommandLogic extends BaseLogic | @@ -79,6 +79,7 @@ class AiCommandLogic extends BaseLogic | ||
| 79 | 'project_id'=>$this->param['project_id']??0, | 79 | 'project_id'=>$this->param['project_id']??0, |
| 80 | ]; | 80 | ]; |
| 81 | $info = $this->model->read($condition); | 81 | $info = $this->model->read($condition); |
| 82 | + | ||
| 82 | if($info !== false){ | 83 | if($info !== false){ |
| 83 | $this->fail('当前编辑的指令key已存在'); | 84 | $this->fail('当前编辑的指令key已存在'); |
| 84 | } | 85 | } |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Aside\User; | ||
| 4 | + | ||
| 5 | +use App\Http\Logic\Aside\BaseLogic; | ||
| 6 | +use App\Models\User\ProjectMenuSeo; | ||
| 7 | + | ||
| 8 | +class ProjectMenuSeoLogic extends BaseLogic | ||
| 9 | +{ | ||
| 10 | + public function __construct() | ||
| 11 | + { | ||
| 12 | + parent::__construct(); | ||
| 13 | + $this->model = new ProjectMenuSeo(); | ||
| 14 | + $this->param = $this->requestAll; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * @remark :添加菜单 | ||
| 19 | + * @name :menu_add | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2025/3/4 15:39 | ||
| 23 | + */ | ||
| 24 | + public function menu_add(){ | ||
| 25 | + //查询当前名称是否存在 | ||
| 26 | + $info = $this->model->read(['name'=>$this->param['name']]); | ||
| 27 | + if($info !== false){ | ||
| 28 | + $this->fail('当前菜单名称已存在'); | ||
| 29 | + } | ||
| 30 | + $rs = $this->model->add($this->param); | ||
| 31 | + if($rs === false){ | ||
| 32 | + $this->fail('添加失败'); | ||
| 33 | + } | ||
| 34 | + return $this->success(); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * @name :编辑菜单 | ||
| 39 | + * @return void | ||
| 40 | + * @author :liyuhang | ||
| 41 | + * @method | ||
| 42 | + */ | ||
| 43 | + public function menu_edit(){ | ||
| 44 | + //查询当前名称是否存在 | ||
| 45 | + $info = $this->model->read(['name'=>$this->param['name'],'id'=>['!=',$this->param['id']]]); | ||
| 46 | + if($info !== false){ | ||
| 47 | + $this->fail('当前菜单名称已存在'); | ||
| 48 | + } | ||
| 49 | + $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 50 | + return $this->success(); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * @name :删除菜单 | ||
| 55 | + * @return void | ||
| 56 | + * @author :liyuhang | ||
| 57 | + * @method | ||
| 58 | + */ | ||
| 59 | + public function menu_del(){ | ||
| 60 | + $ids = $this->param['id']; | ||
| 61 | + //查看当前菜单是否有子菜单 | ||
| 62 | + foreach ($ids as $v){ | ||
| 63 | + $info = $this->model->read(['pid'=>$v],['id','name']); | ||
| 64 | + if($info !== false){ | ||
| 65 | + $this->fail('当前分类存在子分类:'.$info['name'].',不允许删除'); | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + $this->param['id'] = ['in',$this->param['id']]; | ||
| 69 | + $rs = $this->model->del($this->param); | ||
| 70 | + if($rs === false){ | ||
| 71 | + $this->fail('编辑失败'); | ||
| 72 | + } | ||
| 73 | + return $this->success(); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * @remark :添加时获取菜单列表 | ||
| 78 | + * @name :MenuList | ||
| 79 | + * @author :lyh | ||
| 80 | + * @method :post | ||
| 81 | + * @time :2023/6/21 17:26 | ||
| 82 | + */ | ||
| 83 | + public function MenuList($map){ | ||
| 84 | + $lists = $this->model->list($map,'sort'); | ||
| 85 | + $menu = array(); | ||
| 86 | + foreach ($lists as $k => $v){ | ||
| 87 | + $v = (array)$v; | ||
| 88 | + if ($v['pid'] == 0) { | ||
| 89 | + $v['sub'] = _get_child($v['id'], $lists); | ||
| 90 | + $menu[] = $v; | ||
| 91 | + } | ||
| 92 | + } | ||
| 93 | + return $this->success($menu); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + /** | ||
| 97 | + * @remark :当前菜单下的所有权限子菜单 | ||
| 98 | + * @name :roleMenuInfo | ||
| 99 | + * @author :lyh | ||
| 100 | + * @method :post | ||
| 101 | + * @time :2023/8/2 16:24 | ||
| 102 | + */ | ||
| 103 | + public function roleMenuInfo(){ | ||
| 104 | + $list = $this->model->list(['pid'=>$this->param['id']]); | ||
| 105 | + return $this->success($list); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + /** | ||
| 109 | + * @remark :设置排序 | ||
| 110 | + * @name :setSort | ||
| 111 | + * @author :lyh | ||
| 112 | + * @method :post | ||
| 113 | + * @time :2023/8/10 16:42 | ||
| 114 | + */ | ||
| 115 | + public function setParamStatus(){ | ||
| 116 | + $rs = $this->model->edit(['sort'=>$this->param['sort']],['id'=>$this->param['id']]); | ||
| 117 | + if($rs === false){ | ||
| 118 | + $this->fail('修改失败'); | ||
| 119 | + } | ||
| 120 | + return $this->success(); | ||
| 121 | + } | ||
| 122 | +} |
app/Models/User/ProjectMenuSeo.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :ProjectMenuSeo.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/3/4 15:24 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\User; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @remark :白帽seo菜单 | ||
| 16 | + * @name :ProjectMenuSeo | ||
| 17 | + * @author :lyh | ||
| 18 | + * @method :post | ||
| 19 | + * @time :2025/3/4 15:25 | ||
| 20 | + */ | ||
| 21 | +class ProjectMenuSeo extends Base | ||
| 22 | +{ | ||
| 23 | + protected $table = 'gl_project_menu_seo'; | ||
| 24 | +} |
| @@ -50,7 +50,16 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -50,7 +50,16 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 50 | Route::any('/routes', [Aside\User\ProjectMenuController::class, 'routes'])->name('admin.user_menu_routes'); | 50 | Route::any('/routes', [Aside\User\ProjectMenuController::class, 'routes'])->name('admin.user_menu_routes'); |
| 51 | Route::any('/sort', [Aside\User\ProjectMenuController::class, 'sort'])->name('admin.user_menu_sort'); | 51 | Route::any('/sort', [Aside\User\ProjectMenuController::class, 'sort'])->name('admin.user_menu_sort'); |
| 52 | }); | 52 | }); |
| 53 | - | 53 | + //seo白帽菜单管理 |
| 54 | + Route::prefix('seo_menu')->group(function () { | ||
| 55 | + Route::any('/', [Aside\User\ProjectMenuSeoController::class, 'lists'])->name('admin.user_menu_lists'); | ||
| 56 | + Route::any('/info', [Aside\User\ProjectMenuSeoController::class, 'info'])->name('admin.user_menu_info'); | ||
| 57 | + Route::any('/add', [Aside\User\ProjectMenuSeoController::class, 'add'])->name('admin.user_menu_add'); | ||
| 58 | + Route::any('/edit', [Aside\User\ProjectMenuSeoController::class, 'edit'])->name('admin.user_menu_edit'); | ||
| 59 | + Route::any('/del', [Aside\User\ProjectMenuSeoController::class, 'del'])->name('admin.user_menu_del'); | ||
| 60 | + Route::any('/getSonMenu', [Aside\User\ProjectMenuSeoController::class, 'getSonMenu'])->name('admin.user_menu_getSonMenu'); | ||
| 61 | + Route::any('/sort', [Aside\User\ProjectMenuSeoController::class, 'sort'])->name('admin.user_menu_sort'); | ||
| 62 | + }); | ||
| 54 | //用户组 | 63 | //用户组 |
| 55 | Route::prefix('dept')->group(function () { | 64 | Route::prefix('dept')->group(function () { |
| 56 | Route::any('/', [Aside\User\ProjectDeptController::class, 'lists'])->name('admin.user_group_lists'); | 65 | Route::any('/', [Aside\User\ProjectDeptController::class, 'lists'])->name('admin.user_group_lists'); |
| @@ -13,6 +13,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -13,6 +13,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 13 | Route::any('/unbindWechat', [\App\Http\Controllers\Bside\BCom\ComController::class, 'unbindWechat'])->name('unbindWechat'); | 13 | Route::any('/unbindWechat', [\App\Http\Controllers\Bside\BCom\ComController::class, 'unbindWechat'])->name('unbindWechat'); |
| 14 | //获取当前登录用户菜单 | 14 | //获取当前登录用户菜单 |
| 15 | Route::any('/get_menu', [\App\Http\Controllers\Bside\BCom\ComController::class, 'get_menu'])->name('get_menu'); | 15 | Route::any('/get_menu', [\App\Http\Controllers\Bside\BCom\ComController::class, 'get_menu'])->name('get_menu'); |
| 16 | + Route::any('/seo_get_menu', [\App\Http\Controllers\Bside\BCom\ComController::class, 'seo_get_menu'])->name('seo_get_menu'); | ||
| 16 | //自定义菜单 | 17 | //自定义菜单 |
| 17 | Route::any('/getCustomMenu', [\App\Http\Controllers\Bside\BCom\ComController::class, 'getCustomMenu'])->name('get_getCustomMenu'); | 18 | Route::any('/getCustomMenu', [\App\Http\Controllers\Bside\BCom\ComController::class, 'getCustomMenu'])->name('get_getCustomMenu'); |
| 18 | //获取当前登录用户项目详情 | 19 | //获取当前登录用户项目详情 |
-
请 注册 或 登录 后发表评论