初始化仓库
This commit is contained in:
134
app/adminapi/controller/auth/AdminController.php
Normal file
134
app/adminapi/controller/auth/AdminController.php
Normal file
@ -0,0 +1,134 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\controller\auth;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\auth\AdminLists;
|
||||
use app\adminapi\validate\auth\AdminValidate;
|
||||
use app\adminapi\logic\auth\AdminLogic;
|
||||
use app\adminapi\validate\auth\editSelfValidate;
|
||||
|
||||
/**
|
||||
* 管理员控制器
|
||||
* Class AdminController
|
||||
* @package app\adminapi\controller\auth
|
||||
*/
|
||||
class AdminController extends BaseAdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 查看管理员列表
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 9:55
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new AdminLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加管理员
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 10:21
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new AdminValidate())->post()->goCheck('add');
|
||||
$result = AdminLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(AdminLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑管理员
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 11:03
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new AdminValidate())->post()->goCheck('edit');
|
||||
$result = AdminLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(AdminLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除管理员
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 11:03
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new AdminValidate())->post()->goCheck('delete');
|
||||
$result = AdminLogic::delete($params);
|
||||
if (true === $result) {
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(AdminLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 查看管理员详情
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 11:07
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new AdminValidate())->goCheck('detail');
|
||||
$result = AdminLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取当前管理员信息
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2021/12/31 10:53
|
||||
*/
|
||||
public function mySelf()
|
||||
{
|
||||
$result = AdminLogic::detail(['id' => $this->adminId], 'auth');
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑超级管理员信息
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/4/8 17:54
|
||||
*/
|
||||
public function editSelf()
|
||||
{
|
||||
$params = (new editSelfValidate())->post()->goCheck('', ['admin_id' => $this->adminId]);
|
||||
$result = AdminLogic::editSelf($params);
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
}
|
||||
142
app/adminapi/controller/auth/MenuController.php
Normal file
142
app/adminapi/controller/auth/MenuController.php
Normal file
@ -0,0 +1,142 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\controller\auth;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\auth\MenuLists;
|
||||
use app\adminapi\logic\auth\MenuLogic;
|
||||
use app\adminapi\validate\auth\MenuValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 系统菜单权限
|
||||
* Class MenuController
|
||||
* @package app\adminapi\controller\setting\system
|
||||
*/
|
||||
class MenuController extends BaseAdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 获取菜单路由
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/6/29 17:41
|
||||
*/
|
||||
public function route()
|
||||
{
|
||||
$result = MenuLogic::getMenuByAdminId($this->adminId);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取菜单列表
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/6/29 17:23
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new MenuLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 菜单详情
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/6/30 10:07
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new MenuValidate())->goCheck('detail');
|
||||
return $this->data(MenuLogic::detail($params));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加菜单
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/6/30 10:07
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new MenuValidate())->post()->goCheck('add');
|
||||
MenuLogic::add($params);
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑菜单
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/6/30 10:07
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new MenuValidate())->post()->goCheck('edit');
|
||||
MenuLogic::edit($params);
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除菜单
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/6/30 10:07
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new MenuValidate())->post()->goCheck('delete');
|
||||
MenuLogic::delete($params);
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 更新状态
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/7/6 17:04
|
||||
*/
|
||||
public function updateStatus()
|
||||
{
|
||||
$params = (new MenuValidate())->post()->goCheck('status');
|
||||
MenuLogic::updateStatus($params);
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取菜单数据
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/10/13 11:03
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
$result = MenuLogic::getAllData();
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
124
app/adminapi/controller/auth/RoleController.php
Normal file
124
app/adminapi/controller/auth/RoleController.php
Normal file
@ -0,0 +1,124 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\controller\auth;
|
||||
|
||||
use app\adminapi\{
|
||||
logic\auth\RoleLogic,
|
||||
lists\auth\RoleLists,
|
||||
validate\auth\RoleValidate,
|
||||
controller\BaseAdminController
|
||||
};
|
||||
|
||||
/**
|
||||
* 角色控制器
|
||||
* Class RoleController
|
||||
* @package app\adminapi\controller\auth
|
||||
*/
|
||||
class RoleController extends BaseAdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 查看角色列表
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 11:49
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new RoleLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加权限
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 11:49
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new RoleValidate())->post()->goCheck('add');
|
||||
$res = RoleLogic::add($params);
|
||||
if (true === $res) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(RoleLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑角色
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 14:18
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new RoleValidate())->post()->goCheck('edit');
|
||||
$res = RoleLogic::edit($params);
|
||||
if (true === $res) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(RoleLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除角色
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 14:18
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new RoleValidate())->post()->goCheck('del');
|
||||
RoleLogic::delete($params['id']);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 查看角色详情
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 14:18
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new RoleValidate())->goCheck('detail');
|
||||
$detail = RoleLogic::detail($params['id']);
|
||||
return $this->data($detail);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取角色数据
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/10/13 10:39
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
$result = RoleLogic::getAllData();
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user