加入帖子可设置"私密"
This commit is contained in:
@@ -190,6 +190,7 @@ public class Content implements java.io.Serializable {
|
||||
info.setWonderful(wonderful);
|
||||
info.setTop(top);
|
||||
info.setSolved(solved);
|
||||
info.setStatus(status);
|
||||
|
||||
info.setTypeName(types.getOrDefault(type, "其他").toString());
|
||||
info.setCreateTime(LxyKit.dateFmt(createTime));
|
||||
|
@@ -54,10 +54,10 @@ public class ContentBean implements FilterBean,java.io.Serializable {
|
||||
private int top;
|
||||
|
||||
@Column(comment = "[结帖]大于0结帖")
|
||||
private int solved;*/
|
||||
private int solved;
|
||||
|
||||
@Column(comment = "[状态]")
|
||||
private int status = 1;
|
||||
private int status = 1;*/
|
||||
|
||||
public void setContentId(int contentId) {
|
||||
this.contentId = contentId;
|
||||
@@ -139,14 +139,6 @@ public class ContentBean implements FilterBean,java.io.Serializable {
|
||||
this.viewNum = viewNum;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return JsonConvert.root().convertTo(this);
|
||||
|
@@ -56,7 +56,7 @@ public class ContentService extends BaseService{
|
||||
}
|
||||
|
||||
@RestMapping(name = "query", auth = false, comment = "内容列表")
|
||||
public Sheet<ContentInfo> contentQuery(Flipper flipper, String actived){
|
||||
public Sheet<ContentInfo> contentQuery(Flipper flipper, String actived, int currentId){
|
||||
FilterNode filterNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -1);
|
||||
switch (actived){
|
||||
case "top": filterNode.and("top", 1);break;
|
||||
@@ -65,6 +65,12 @@ public class ContentService extends BaseService{
|
||||
case "solved": filterNode.and("solved", 1);break;
|
||||
case "wonderful": filterNode.and("wonderful", 1);break;
|
||||
}
|
||||
if (currentId > 0){
|
||||
filterNode.and(FilterNode.create("status", FilterExpress.NOTEQUAL, 3).or(FilterNode.create("status", 3).and("userId", currentId)));
|
||||
}else {
|
||||
filterNode.and("status", FilterExpress.NOTEQUAL, 3);
|
||||
}
|
||||
|
||||
return contentQuery(flipper, filterNode);
|
||||
}
|
||||
|
||||
@@ -102,7 +108,7 @@ public class ContentService extends BaseService{
|
||||
|
||||
source.insert(content);
|
||||
}else {
|
||||
source.updateColumn(content, SelectColumn.createIncludes("title", "digest", "content","type"));
|
||||
source.updateColumn(content, SelectColumn.createIncludes("title", "digest", "content","type", "status"));
|
||||
}
|
||||
|
||||
return RetResult.success();
|
||||
@@ -206,7 +212,7 @@ public class ContentService extends BaseService{
|
||||
|
||||
//热议
|
||||
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "");
|
||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", 0);
|
||||
|
||||
//最新加入
|
||||
Sheet<UserInfo> lastReg = userService.lastReg();
|
||||
|
@@ -47,11 +47,11 @@ public class IndexServlet extends BaseServlet {
|
||||
Flipper flipper = new Flipper().limit(30).sort("top DESC,createTime DESC");
|
||||
//置顶贴
|
||||
FilterNode topNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -1).and("top", FilterExpress.GREATERTHAN, 0);
|
||||
Sheet<ContentInfo> top = contentService.contentQuery(flipper, topNode);
|
||||
Sheet<ContentInfo> top = contentService.contentQuery(flipper, setPrivate(topNode));
|
||||
|
||||
//非置顶贴
|
||||
FilterNode untopNode = FilterNode.create("status", FilterExpress.NOTEQUAL, -1).and("top", 0);
|
||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, untopNode);
|
||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, setPrivate(untopNode));
|
||||
|
||||
//热帖
|
||||
/*Flipper flipper2 = new Flipper().limit(8).sort("viewNum DESC");
|
||||
@@ -59,7 +59,7 @@ public class IndexServlet extends BaseServlet {
|
||||
|
||||
//热议
|
||||
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "");
|
||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentId());
|
||||
|
||||
//最新加入
|
||||
Sheet<UserInfo> lastReg = userService.lastReg();
|
||||
@@ -86,11 +86,11 @@ public class IndexServlet extends BaseServlet {
|
||||
if (solved > -1) filterNode.and("solved", solved);
|
||||
if (wonderful > -1) filterNode.and("wonderful", wonderful);
|
||||
|
||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, filterNode);
|
||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, setPrivate(filterNode));
|
||||
|
||||
//热议
|
||||
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "");
|
||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentId());
|
||||
|
||||
|
||||
Kv kv = Kv.by("contents", contents).set("hotReply", hotReply)
|
||||
@@ -194,7 +194,7 @@ public class IndexServlet extends BaseServlet {
|
||||
|
||||
//分页帖子列表
|
||||
Flipper flipper = new Flipper().offset((curr-1)*15).limit(15).sort("top DESC,createTime DESC");
|
||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, actived);
|
||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, actived, currentId());
|
||||
|
||||
Kv kv = Kv.by("contents", contents).set("url", request.getRequestURI())
|
||||
.set("actived", actived).set("curr", curr);
|
||||
@@ -227,7 +227,7 @@ public class IndexServlet extends BaseServlet {
|
||||
|
||||
//热议
|
||||
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
|
||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "");
|
||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", currentId());
|
||||
|
||||
//更新
|
||||
CompletableFuture.supplyAsync(new Supplier<String>() {
|
||||
|
Reference in New Issue
Block a user