This commit is contained in:
2017-12-05 11:59:58 +08:00
parent 5c708a3efd
commit 92d3f7a49e
50 changed files with 2396 additions and 1717 deletions

View File

@@ -29,6 +29,9 @@ public class BaseServlet extends HttpServlet {
@Resource
protected UserService userService;
/*@Resource(name = "redis")
protected RedisCacheSource<String> cache;*/
private HttpRequest request;
private HttpResponse response;
private static final Kv _kv = Kv.create();
@@ -53,6 +56,10 @@ public class BaseServlet extends HttpServlet {
_kv.set("mine", request.currentUser());
}
/*cache.set("a", "ABC");
String a = cache.get("a");
System.out.println(a);*/
this.request = request;
this.response = response;
String uri = request.getRequestURI();

View File

@@ -29,7 +29,7 @@ public class EJ {
/*EJ ej = new EJ();
System.out.println(ej.date(1511682960591L));*/
List<Kv> list = asList(
/*List<Kv> list = asList(
Kv.by("k", 1).set("a", "1+1=?").set("q", 2)
, Kv.by("k", 2).set("a", "1*1=?").set("q", 1)
, Kv.by("k", 3).set("a", "3+2-5=?").set("q", 0)
@@ -41,7 +41,7 @@ public class EJ {
System.out.println(System.currentTimeMillis());
System.out.println(kv.toString());
System.out.println(kv.getStr("q").equals("0"));
System.out.println(kv.getStr("q").equals("0"));*/
}

View File

@@ -25,7 +25,7 @@ public class FileService extends BaseService {
String name = tmpFile.getName();
String suffix = name.substring(name.lastIndexOf("."));
String path = String.format(format, System.currentTimeMillis()) + suffix;
File destFile = new File((winos ? "E:/wk/_own/bbs/root/tem/" : dir) + path);
File destFile = new File((winos ? "E:/wk/redbbs/root/tem/" : dir) + path);
destFile.getParentFile().mkdir();
if (!tmpFile.renameTo(destFile)){
try{

View File

@@ -17,9 +17,10 @@ import java.util.function.Supplier;
/**
* Created by Lxy at 2017/11/25 12:31.
*/
@WebServlet({"/"
@WebServlet({"/","/site"
,"/user", "/user/*"
,"/jie" ,"/jie/*"})
,"/jie" ,"/jie/*"
})
public class IndexServlet extends BaseServlet {
@Resource
@@ -39,8 +40,8 @@ public class IndexServlet extends BaseServlet {
Sheet<ContentInfo> top = contentService.contentQuery(flipper, "top");
//热帖
Flipper flipper2 = new Flipper().limit(8).sort("viewNum DESC");
Sheet<ContentInfo> hotView = contentService.contentQuery(flipper2, "");
/*Flipper flipper2 = new Flipper().limit(8).sort("viewNum DESC");
Sheet<ContentInfo> hotView = contentService.contentQuery(flipper2, "");*/
//热议
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
@@ -49,10 +50,16 @@ public class IndexServlet extends BaseServlet {
//最新加入
Sheet<UserInfo> lastReg = userService.lastReg();
Kv kv = Kv.by("top", top).set("contents", contents).set("hotView", hotView).set("hotReply", hotReply).set("lastReg", lastReg);
Kv kv = Kv.by("top", top).set("contents", contents)/*.set("hotView", hotView)*/.set("hotReply", hotReply).set("lastReg", lastReg);
finish("index.html", kv);
}
@HttpMapping(url = "/site", auth = false, comment = "网站首页")
public void site(HttpRequest request, HttpResponse response){
finish("/site.html");
}
//====================================用户相关====================================
@HttpMapping(url = "/user/login", auth = false, comment = "前往登录页")
@@ -171,8 +178,8 @@ public class IndexServlet extends BaseServlet {
Sheet<CommentInfo> comments = commentService.commentQuery(request.getSessionid(false) ,contentid, new Flipper().limit(30));
//热帖
Flipper flipper2 = new Flipper().limit(8).sort("viewNum DESC");
Sheet<ContentInfo> hotView = contentService.contentQuery(flipper2, "");
//Flipper flipper2 = new Flipper().limit(8).sort("viewNum DESC");
//Sheet<ContentInfo> hotView = contentService.contentQuery(flipper2, "");
//热议
Flipper flipper3 = new Flipper().limit(8).sort("replyNum DESC");
@@ -187,7 +194,7 @@ public class IndexServlet extends BaseServlet {
}
});
Kv kv = Kv.by("bean", content).set("comments", comments).set("hotView", hotView).set("hotReply", hotReply);
Kv kv = Kv.by("bean", content).set("comments", comments)/*.set("hotView", hotView)*/.set("hotReply", hotReply);
finish("/jie/detail.html", kv);
}