wiki增加开放访问

This commit is contained in:
暮光:城中城
2019-03-22 03:45:06 +08:00
parent 42ed560750
commit b498a513dc
5 changed files with 34 additions and 5 deletions

View File

@@ -72,9 +72,17 @@ public class WikiPageCommentController {
@PostMapping("/update")
public ResponseJson<Object> update(WikiPageComment pageComment) {
Long id = pageComment.getId();
Long pageId;
if (id != null && id > 0) {
WikiPageComment pageCommentSel = wikiPageCommentService.getById(id);
pageId = pageCommentSel.getPageId();
} else if (pageComment.getPageId() != null) {
pageId = pageComment.getPageId();
} else {
return DocResponseJson.warn("需指定所属页面!");
}
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
WikiPage wikiPageSel = wikiPageService.getById(pageComment.getPageId());
WikiPage wikiPageSel = wikiPageService.getById(pageId);
WikiSpace wikiSpaceSel = wikiSpaceService.getById(wikiPageSel.getSpaceId());
// 私人空间
if (Objects.equals(wikiSpaceSel.getType(), 3) && !currentUser.getUserId().equals(wikiSpaceSel.getCreateUserId())) {

View File

@@ -123,6 +123,7 @@ public class WikiPageController {
if (wikiPageSel == null || Objects.equals(wikiPageSel.getEditType(), 1)) {
return DocResponseJson.warn("当前页面不允许编辑!");
}
wikiPage.setEditType(null);
wikiPage.setUpdateTime(new Date());
wikiPage.setUpdateUserId(currentUser.getUserId());
wikiPage.setUpdateUserName(currentUser.getUsername());

View File

@@ -54,13 +54,22 @@ public class WikiPageFileController {
@PostMapping("/update")
public ResponseJson<Object> update(WikiPageFile wikiPageFile) {
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
WikiPage wikiPageSel = wikiPageService.getById(wikiPageFile.getPageId());
Long id = wikiPageFile.getId();
Long pageId;
if (id != null && id > 0) {
WikiPageFile pageFileSel = wikiPageFileService.getById(wikiPageFile.getId());
pageId = pageFileSel.getPageId();
} else if (wikiPageFile.getPageId() != null) {
pageId = wikiPageFile.getPageId();
} else {
return DocResponseJson.warn("需指定修改文件的所属页面!");
}
WikiPage wikiPageSel = wikiPageService.getById(pageId);
WikiSpace wikiSpaceSel = wikiSpaceService.getById(wikiPageSel.getSpaceId());
// 私人空间
if (Objects.equals(wikiSpaceSel.getType(), 3) && !currentUser.getUserId().equals(wikiSpaceSel.getCreateUserId())) {
return DocResponseJson.warn("您没有该空间的文件上传权限!");
}
Long id = wikiPageFile.getId();
if (id != null && id > 0) {
wikiPageFile.setUpdateUserId(currentUser.getUserId());
wikiPageFile.setUpdateUserName(currentUser.getUsername());

View File

@@ -59,7 +59,17 @@ public class WikiPageZanController {
@PostMapping("/update")
public ResponseJson<Object> update(WikiPageZan wikiPageZan) {
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
WikiPage wikiPageSel = wikiPageService.getById(wikiPageZan.getPageId());
Long id = wikiPageZan.getId();
Long pageId;
if (id != null && id > 0) {
WikiPageZan wikiPageZanSel = wikiPageZanService.getById(id);
pageId = wikiPageZanSel.getPageId();
} else if (wikiPageZan.getPageId() != null) {
pageId = wikiPageZan.getPageId();
} else {
return DocResponseJson.warn("需指定所属页面!");
}
WikiPage wikiPageSel = wikiPageService.getById(pageId);
WikiSpace wikiSpaceSel = wikiSpaceService.getById(wikiPageSel.getSpaceId());
// 私人空间
if (Objects.equals(wikiSpaceSel.getType(), 3) && !currentUser.getUserId().equals(wikiSpaceSel.getCreateUserId())) {

View File

@@ -57,6 +57,7 @@ public class WikiSpaceController {
return DocResponseJson.warn("您没有该空间的编辑权!");
}
wikiSpace.setUuid(null);
wikiSpace.setEditType(null);
wikiSpaceService.updateById(wikiSpace);
} else {
wikiSpace.setUuid(RandomUtil.simpleUUID());