123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
- // +----------------------------------------------------------------------
- // | [ WE CAN DO IT MORE SIMPLE ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2018-2020 rights reserved.
- // +----------------------------------------------------------------------
- // |
- // +----------------------------------------------------------------------
- // | Date: 2020-08-31 20:43
- // +----------------------------------------------------------------------
- namespace app\system\controller;
- use app\BaseController;
- use app\model\system\AdminRole;
- use app\model\system\RolePath as RolePathModel;
- use app\Request;
- use library\services\UtilService;
- class RolePath extends BaseController
- {
- /**
- * 基本设置
- */
- public function list()
- {
- $menuMenu = new RolePathModel();
- $menus = $menuMenu->getArMenu();
- return app('json')->success($menus);
- }
- /**
- * 获取树级分类
- */
- public function treeList()
- {
- $menuAr = (new RolePathModel())->order("seq", "desc")->select()->toArray();
- $data = sort_list_tier($menuAr, '顶级', 'pid', 'id');
- return app('json')->success($data);
- }
- /**
- * 获取详情栏目数据
- */
- public function info(Request $request)
- {
- [$id] = UtilService::getMore([
- ['id', 0, 'empty', '参数错误'],
- ], $request, true);
- $data = (new RolePathModel())->find(compact('id'))->toArray();
- return app('json')->success($data);
- }
- /**
- * 保存数据
- */
- public function save(Request $request)
- {
- $post = UtilService::getMore([
- ['id',''],
- ['title', ''],
- ['pid', '0'],
- ['seq', '0'],
- ['role_path', ''],
- ['menu_id', ''],
- ['is_show', '0']
- ], $request);
- (new RolePathModel())->saveModel($post);
- return app('json')->success("数据保存成功");
- }
- /**
- * 栏目删除
- * @param Request $request
- * @return mixed
- */
- public function del(Request $request)
- {
- [$id] = UtilService::getMore([
- ['id', 0, 'empty', '参数错误'],
- ], $request, true);
- $bool = (new RolePathModel())->delMenu($id);
- return app('json')->success("栏目删除成功");
- }
- /**
- * 系统分类显示 | 关闭
- */
- public function status(Request $request)
- {
- [$id, $is_show] = UtilService::getMore([
- ['id', '0', 'empty', '参数错误'],
- ['is_show', '0'],
- ], $request, true);
- $bool = (new RolePathModel())->setStatus($id, $is_show);
- if ($bool) {
- return app('json')->success('操作成功');
- } else {
- return app('json')->fail('提交失败');
- }
- }
- }
|