🎨 区分上传文件类型

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.setTagTitle(tag.getTagTitle());
newTag.setTagUri(tag.getTagUri()); newTag.setTagUri(tag.getTagUri());
if (StringUtils.isNotBlank(tag.getTagIconPath()) && tag.getTagIconPath().contains("base64")) { 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); newTag.setTagIconPath(tagIconPath);
} else { } else {
newTag.setTagIconPath(tag.getTagIconPath()); newTag.setTagIconPath(tag.getTagIconPath());
@ -158,7 +158,7 @@ public class TagServiceImpl extends AbstractService<Tag> implements TagService {
} else { } else {
tag.setUpdatedTime(new Date()); tag.setUpdatedTime(new Date());
if (StringUtils.isNotBlank(tag.getTagIconPath()) && tag.getTagIconPath().contains("base64")) { 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); tag.setTagIconPath(tagIconPath);
} }
result = tagMapper.update(tag.getIdTag(), tag.getTagUri(), tag.getTagIconPath(), tag.getTagStatus(), tag.getTagDescription(), tag.getTagReservation()); 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.setTopicTitle(topic.getTopicTitle());
newTopic.setTopicUri(topic.getTopicUri()); newTopic.setTopicUri(topic.getTopicUri());
if (StringUtils.isNotBlank(topic.getTopicIconPath()) && topic.getTopicIconPath().contains("base64")) { 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); newTopic.setTopicIconPath(topicIconPath);
} else { } else {
newTopic.setTopicIconPath(topic.getTopicIconPath()); newTopic.setTopicIconPath(topic.getTopicIconPath());
@ -81,7 +81,7 @@ public class TopicServiceImpl extends AbstractService<Topic> implements TopicSer
result = topicMapper.insertSelective(newTopic); result = topicMapper.insertSelective(newTopic);
} else { } else {
if (StringUtils.isNotBlank(topic.getTopicIconPath()) && topic.getTopicIconPath().contains("base64")) { 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.setTopicIconPath(topicIconPath);
} }
topic.setUpdatedTime(new Date()); topic.setUpdatedTime(new Date());

View File

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