fix:上传图片

上级 5c321f05
......@@ -19,7 +19,7 @@ public class PicInfo extends Model<PicInfo> {
private String picName;
//图片地址
private String picUrl;
//图片类型,0:表示宝宝图片
//图片类型,0:表示宝宝图片,1:学习图片,2:风景,3:美女,99:其他
private Integer type;
private Date createTime;
private Integer isDelete;
......
......@@ -48,7 +48,11 @@ public class PicInfoServiceImpl extends ServiceImpl<PicInfoMapper, PicInfo> impl
if (Files.isRegularFile(filePath)) {
final String picNameOrigin = filePath.getFileName().toString();
String picPath = PRE_FIX + picNameOrigin;
final String picName = picNameOrigin.split(".")[0];
final String[] split = picNameOrigin.split(".");
String picName = picNameOrigin;
if (Objects.nonNull(split) && split.length > 0) {
picName = split[0];
}
this.insertPic(type, picPath, picName);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册