test_lgq/niucloud/app/service/admin/generator/vm/controller.vm
2024-01-24 17:36:08 +08:00

78 lines
2.0 KiB
Plaintext
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 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
{NAMESPACE}
{USE}
/**
* {CLASS_COMMENT}
* Class {UCASE_CLASS_NAME}
* @package {PACKAGE_NAME}
*/
class {UCASE_CLASS_NAME} extends BaseAdminController
{
/**
* 获取{NOTES}列表
* @return \think\Response
*/
public function lists(){
$data = $this->request->params([
{SEARCH_PARAMS}
]);
return success((new {UCASE_NAME}Service())->getPage($data));
}
/**
* {NOTES}详情
* @param int $id
* @return \think\Response
*/
public function info(int $id){
return success((new {UCASE_NAME}Service())->getInfo($id));
}
/**
* 添加{NOTES}
* @return \think\Response
*/
public function add(){
$data = $this->request->params({ADD_FILED_NOTE});
$this->validate($data, '{VALIDATE}.add');
$id = (new {UCASE_NAME}Service())->add($data);
return success('ADD_SUCCESS', ['id' => $id]);
}
/**
* {NOTES}编辑
* @param $id {NOTES}id
* @return \think\Response
*/
public function edit(int $id){
$data = $this->request->params({EDIT_FILED_NOTE});
$this->validate($data, '{VALIDATE}.edit');
(new {UCASE_NAME}Service())->edit($id, $data);
return success('EDIT_SUCCESS');
}
/**
* {NOTES}删除
* @param $id {NOTES}id
* @return \think\Response
*/
public function del(int $id){
(new {UCASE_NAME}Service())->del($id);
return success('DELETE_SUCCESS');
}
{WITH_CONTROLLER}
}