关于文件编辑方法注释

This commit is contained in:
442384644@qq.com 2022-01-13 09:23:50 +08:00
parent f675d86f75
commit 28cebb4d85
2 changed files with 29 additions and 29 deletions

View File

@ -44,34 +44,34 @@ class SystemFile extends AuthController
}
//打开目录
public function opendir()
{
return app('json')->success($this->services->opendir());
}
// public function opendir()
// {
// return app('json')->success($this->services->opendir());
// }
//读取文件
public function openfile()
{
$file = $this->request->param('filepath');
if (empty($file)) return app('json')->fail('出现错误');
return app('json')->success($this->services->openfile($file));
}
// public function openfile()
// {
// $file = $this->request->param('filepath');
// if (empty($file)) return app('json')->fail('出现错误');
// return app('json')->success($this->services->openfile($file));
// }
//保存文件
public function savefile()
{
return app('json')->fail('请勿在生产环境使用,该接口存在危险性!!!');//如果开发环境,可以注释本行
$comment = $this->request->param('comment');
$filepath = $this->request->param('filepath');
if(empty($comment) || empty($filepath)){
return app('json')->fail('出现错误');
}
$res = $this->services->savefile($filepath,$comment);
if ($res) {
return app('json')->success('保存成功!');
} else {
return app('json')->fail('保存失败');
}
}
// public function savefile()
// {
// return app('json')->fail('请勿在生产环境使用,该接口存在危险性!!!');//如果开发环境,可以注释本行
//
// $comment = $this->request->param('comment');
// $filepath = $this->request->param('filepath');
// if(empty($comment) || empty($filepath)){
// return app('json')->fail('出现错误');
// }
// $res = $this->services->savefile($filepath,$comment);
// if ($res) {
// return app('json')->success('保存成功!');
// } else {
// return app('json')->fail('保存失败');
// }
// }
}

View File

@ -22,11 +22,11 @@ Route::group('system', function () {
//文件校验
Route::get('file', 'v1.system.SystemFile/index')->name('SystemFile')->option(['real_name' => '文件校验']);
//打开目录
Route::get('file/opendir', 'v1.system.SystemFile/opendir')->option(['real_name' => '打开目录']);
// Route::get('file/opendir', 'v1.system.SystemFile/opendir')->option(['real_name' => '打开目录']);
//读取文件
Route::get('file/openfile', 'v1.system.SystemFile/openfile')->option(['real_name' => '读取文件']);
// Route::get('file/openfile', 'v1.system.SystemFile/openfile')->option(['real_name' => '读取文件']);
//保存文件
Route::post('file/savefile', 'v1.system.SystemFile/savefile')->option(['real_name' => '保存文件']);
// Route::post('file/savefile', 'v1.system.SystemFile/savefile')->option(['real_name' => '保存文件']);
//数据所有表
Route::get('backup', 'v1.system.SystemDatabackup/index')->option(['real_name' => '数据库所有表']);
//数据备份详情