设置图片路径

This commit is contained in:
2025-09-19 09:43:52 +08:00
parent 397f227bfb
commit 3e19cd9db2

View File

@ -267,9 +267,13 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
// 处理上传的图片 // 处理上传的图片
if (deviceForm.getFile() != null) { if (deviceForm.getFile() != null) {
SysOssVo upload = ossService.upload(deviceForm.getFile());
// 设置图片路径 // 设置图片路径
deviceForm.setDevicePic(upload.getUrl()); SysOssVo oss = ossService.upload(deviceForm.getFile());
// 强制将HTTP替换为HTTPS
if (oss.getUrl() != null && oss.getUrl().startsWith("http://")) {
oss.setUrl(oss.getUrl().replaceFirst("^http://", "https://"));
}
deviceForm.setDevicePic(oss.getUrl());
} }
// 更新字段 // 更新字段
@ -665,7 +669,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
* 获取设备使用数据 * 获取设备使用数据
* *
* @param deviceTypeId 设备ID * @param deviceTypeId 设备ID
* @param range 时间范围 1:半年 2:一年 * @param range 时间范围 1:半年 2:一年
* @return 每月使用数据列表 * @return 每月使用数据列表
*/ */
@Override @Override