【新增】完善固件上传
This commit is contained in:
@@ -39,14 +39,14 @@ public class FirmwareServiceImpl extends ServiceImpl<FirmwareMapper, Firmware> i
|
||||
@Override
|
||||
public boolean uploadFile(MultipartFile file, Long id) {
|
||||
try {
|
||||
String downloadUrl = OSSUploadUtil.uploadFile(file.getInputStream(), "/");
|
||||
String downloadUrl = OSSUploadUtil.uploadFile(file.getInputStream(), file.getOriginalFilename());
|
||||
Firmware firmware = getById(id);
|
||||
firmware.setFirmwareSize(file.getSize());
|
||||
firmware.setDownloadUrl(downloadUrl);
|
||||
updateById(firmware);
|
||||
return updateById(firmware);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
# 应用服务 WEB 访问端口
|
||||
server.port=8080
|
||||
|
||||
# 单文件最大大小(例如:10MB,支持单位:B, KB, MB, GB)
|
||||
spring.servlet.multipart.max-file-size=10MB
|
||||
# 一次请求中所有文件的总大小(例如:50MB)
|
||||
spring.servlet.multipart.max-request-size=50MB
|
||||
|
||||
# 数据源配置
|
||||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
|
||||
@@ -545,6 +545,7 @@
|
||||
$message.success('固件上传成功');
|
||||
this.$refs.firmwareFileRef.value = "";
|
||||
this.modalInstances['uploadFileModal'].hide();
|
||||
this.fetchData();
|
||||
} else {
|
||||
$message.error("上传失败:" + response.data.message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user