magic-boot/data/magic-api/api/后台/文件管理/裁剪.ms

39 lines
1011 B
Plaintext
Raw Normal View History

2021-10-24 20:09:53 +08:00
{
"properties" : { },
"id" : "874aea2c17ca4c79bcdff3d4cc458c87",
"script" : null,
"groupId" : "fd3d225a1cf141bf9998c4ec4bf4a6ab",
"name" : "裁剪",
"createTime" : 1646490239458,
2022-02-01 18:26:42 +08:00
"updateTime" : 1643706719537,
2021-10-24 20:09:53 +08:00
"lock" : "0",
"createBy" : null,
"updateBy" : null,
2021-10-24 20:09:53 +08:00
"path" : "/cropper",
"method" : "POST",
2021-10-24 20:09:53 +08:00
"parameters" : [ ],
"options" : [ ],
2021-10-24 20:09:53 +08:00
"requestBody" : "",
"headers" : [ ],
"paths" : [ ],
"responseBody" : null,
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
2021-10-24 20:09:53 +08:00
}
================================
2022-02-01 18:26:42 +08:00
import org.ssssssss.magicboot.model.Global
import org.ssssssss.magicboot.utils.FileUtils
import cn.hutool.core.io.FileUtil;
import java.net.URLDecoder
import request;
2021-10-24 20:09:53 +08:00
url = URLDecoder.decode(url, "UTF-8");
String realPath = Global.getUserFilesBaseDir() + "/" + url;
FileUtil.del(realPath);
var map = FileUtils.saveFile(request.getFile('file'));
db.table("sys_file").column("url", map.url).where().eq("url", url).update()
return map