fix(music-houduan): 修复轮播图图片路径问题
- 修改了 BannerServiceImpl 类中的图片上传逻辑 - 使用 replace 方法移除了绝对路径中的项目目录和操作系统分隔符 -确保保存的图片路径为相对路径,格式为 /upload/images/...
This commit is contained in:
@@ -101,7 +101,8 @@ public class BannerServiceImpl implements BannerService {
|
|||||||
|
|
||||||
// 上传新图片
|
// 上传新图片
|
||||||
String imageUrl = fileService.uploadImage(image);
|
String imageUrl = fileService.uploadImage(image);
|
||||||
banner.setImageUrl(imageUrl); // imageUrl已经是 /upload/images/... 格式
|
String Url = imageUrl.replace(System.getProperty("user.dir") + File.separator + "music-houduan", "").replace(File.separator, "/");
|
||||||
|
banner.setImageUrl(Url); // imageUrl已经是 /upload/images/... 格式
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新轮播图信息
|
// 更新轮播图信息
|
||||||
|
|||||||
Reference in New Issue
Block a user