全栈小学生 0e47055ccb v1.0.0-beta.1
2023-04-15 17:12:49 +08:00

112 lines
2.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud-admin.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\diy;
use app\adminapi\controller\BaseAdminController;
use app\service\admin\diy\DiyRouteService;
/**
* 自定义路由表控制器
* Class DiyRouteController
* @package app\adminapi\controller\diy
*/
class DiyRoute extends BaseAdminController
{
/**
* @notes 获取自定义路由表列表
* @return \think\Response
*/
public function lists()
{
$data = $this->request->params([
[ "title", "" ],
[ "name", "" ],
[ "page", "" ],
[ "sort", "" ]
]);
return success(( new DiyRouteService() )->getPage($data));
}
/**
* 自定义路由表详情
* @param int $id
* @return \think\Response
*/
public function info(int $id)
{
return success(( new DiyRouteService() )->getInfo($id));
}
/**
* 添加自定义路由表
* @return \think\Response
*/
public function add()
{
$data = $this->request->params([
[ "title", "" ],
[ "name", "" ],
[ "page", "" ],
[ "share", "" ],
[ "is_share", "" ]
]);
$this->validate($data, 'app\validate\diy\DiyRoute.add');
$id = ( new DiyRouteService() )->add($data);
return success(100011, [ 'id' => $id ]);
}
/**
* 自定义路由表编辑
* @param $id 自定义路由表id
* @return \think\Response
*/
public function update($id)
{
$data = $this->request->params([
[ "title", "" ],
[ "name", "" ],
[ "page", "" ],
[ "share", "" ],
[ "is_share", "" ]
]);
$this->validate($data, 'app\validate\diy\DiyRoute.update');
( new DiyRouteService() )->update($id, $data);
return success(100004);
}
/**
* 自定义路由表删除
* @param $id 自定义路由表id
* @return \think\Response
*/
public function del(int $id)
{
( new DiyRouteService() )->del($id);
return success(100003);
}
/**
* 修改页面分享内容
* @param int $id
*/
public function modifyShare(int $id)
{
$data = $this->request->params([
[ "share", "" ],
]);
( new DiyRouteService() )->modifyShare($id, $data);
return success(100004);
}
}