Skip to content

Commit

Permalink
修复 issue bug atjiu#93
Browse files Browse the repository at this point in the history
  • Loading branch information
atjiu committed Jun 29, 2019
1 parent 55033a8 commit 09c2250
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public Result create(@RequestBody Map<String, String> body, HttpSession session)
ApiAssert.isTrue(user.getActive(), "你的帐号还没有激活,请去个人设置页面激活帐号");
String title = body.get("title");
String content = body.get("content");
String tag = body.get("tag");
// String tags = body.get("tags");
ApiAssert.notEmpty(title, "请输入标题");
ApiAssert.isNull(topicService.selectByTitle(title), "话题标题重复");
Expand All @@ -92,7 +93,7 @@ public Result create(@RequestBody Map<String, String> body, HttpSession session)
// 保存话题
// 再次将tag转成逗号隔开的字符串
// tags = StringUtils.collectionToCommaDelimitedString(set);
Topic topic = topicService.insert(title, content, null, user, session);
Topic topic = topicService.insert(title, content, tag, user, session);
topic.setContent(SensitiveWordUtil.replaceSensitiveWord(topic.getContent(), "*", SensitiveWordUtil.MinMatchType));
return success(topic);
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/templates/theme/default/topic/create.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<input type="text" name="tags" id="tags" value="${tag!}" class="form-control"
placeholder="标签, 多个标签以 英文逗号 隔开"/>
</div>-->
<input type="hidden" name="tag" id="tag" value="${tag!}"/>
<div class="form-group">
<button type="button" id="btn" class="btn btn-info">发布话题</button>
</div>
Expand Down Expand Up @@ -53,6 +54,7 @@
$("#btn").click(function () {
var title = $("#title").val();
var tag = $("#tag").val();
var content = window.editor.getDoc().getValue();
// var tags = $("#tags").val();
if (!title || title.length > 120) {
Expand All @@ -78,6 +80,7 @@
data: JSON.stringify({
title: title,
content: content,
tag: tag,
// tags: tags,
}),
success: function (data) {
Expand Down

0 comments on commit 09c2250

Please sign in to comment.