🎨 区分上传文件类型

This commit is contained in:
ronger 2022-01-13 22:21:51 +08:00
parent 2bed7765bc
commit 6314e0fa48
3 changed files with 8 additions and 5 deletions

View File

@ -144,7 +144,7 @@ public class TagServiceImpl extends AbstractService<Tag> implements TagService {
newTag.setTagTitle(tag.getTagTitle());
newTag.setTagUri(tag.getTagUri());
if (StringUtils.isNotBlank(tag.getTagIconPath()) && tag.getTagIconPath().contains("base64")) {
String tagIconPath = UploadController.uploadBase64File(tag.getTagIconPath(), 0);
String tagIconPath = UploadController.uploadBase64File(tag.getTagIconPath(), 2);
newTag.setTagIconPath(tagIconPath);
} else {
newTag.setTagIconPath(tag.getTagIconPath());
@ -158,7 +158,7 @@ public class TagServiceImpl extends AbstractService<Tag> implements TagService {
} else {
tag.setUpdatedTime(new Date());
if (StringUtils.isNotBlank(tag.getTagIconPath()) && tag.getTagIconPath().contains("base64")) {
String tagIconPath = UploadController.uploadBase64File(tag.getTagIconPath(), 0);
String tagIconPath = UploadController.uploadBase64File(tag.getTagIconPath(), 2);
tag.setTagIconPath(tagIconPath);
}
result = tagMapper.update(tag.getIdTag(), tag.getTagUri(), tag.getTagIconPath(), tag.getTagStatus(), tag.getTagDescription(), tag.getTagReservation());

View File

@ -66,7 +66,7 @@ public class TopicServiceImpl extends AbstractService<Topic> implements TopicSer
newTopic.setTopicTitle(topic.getTopicTitle());
newTopic.setTopicUri(topic.getTopicUri());
if (StringUtils.isNotBlank(topic.getTopicIconPath()) && topic.getTopicIconPath().contains("base64")) {
String topicIconPath = UploadController.uploadBase64File(topic.getTopicIconPath(), 0);
String topicIconPath = UploadController.uploadBase64File(topic.getTopicIconPath(), 3);
newTopic.setTopicIconPath(topicIconPath);
} else {
newTopic.setTopicIconPath(topic.getTopicIconPath());
@ -81,7 +81,7 @@ public class TopicServiceImpl extends AbstractService<Topic> implements TopicSer
result = topicMapper.insertSelective(newTopic);
} else {
if (StringUtils.isNotBlank(topic.getTopicIconPath()) && topic.getTopicIconPath().contains("base64")) {
String topicIconPath = UploadController.uploadBase64File(topic.getTopicIconPath(), 0);
String topicIconPath = UploadController.uploadBase64File(topic.getTopicIconPath(), 3);
topic.setTopicIconPath(topicIconPath);
}
topic.setUpdatedTime(new Date());

View File

@ -57,7 +57,10 @@ public class UploadController {
typePath = "article";
break;
case 2:
typePath = "tags";
typePath = "tag";
break;
case 3:
typePath = "topic";
break;
default:
typePath = "images";