1、默认去除redis使用
2、默认去除日志的记录,可少配置一个mongodb或者 arangodb, 下载后导入数据库,并配置便可直接运行。
This commit is contained in:
parent
789acd698b
commit
25d4266d74
@ -3,9 +3,10 @@
|
|||||||
<application port="5002">
|
<application port="5002">
|
||||||
<!-- 详细配置说明见: http://redkale.org/redkale.html#redkale_confxml -->
|
<!-- 详细配置说明见: http://redkale.org/redkale.html#redkale_confxml -->
|
||||||
<resources>
|
<resources>
|
||||||
<source name="redis" value="org.redkalex.cache.RedisCacheSource" xxx="16">
|
<!-- 如果需要使用redis,此处配置 -->
|
||||||
|
<!--<source name="redis" value="org.redkalex.cache.RedisCacheSource" xxx="16">
|
||||||
<node addr="redishost" port="6379" password="pwd123"/>
|
<node addr="redishost" port="6379" password="pwd123"/>
|
||||||
</source>
|
</source>-->
|
||||||
<properties>
|
<properties>
|
||||||
<property name="mongo.host" value="redishost"/>
|
<property name="mongo.host" value="redishost"/>
|
||||||
<property name="mongo.database" value="redbbs"/>
|
<property name="mongo.database" value="redbbs"/>
|
||||||
|
@ -21,8 +21,10 @@ public class BaseService implements Service {
|
|||||||
@Resource(name = "art123")
|
@Resource(name = "art123")
|
||||||
protected DataSource source;
|
protected DataSource source;
|
||||||
|
|
||||||
@Resource(name = "redis")
|
/* 使用redis 代码中配置此处即可
|
||||||
protected CacheSource<Integer> sessions;
|
@Resource(name = "redis")*/
|
||||||
|
@Resource(name = "cacheSource")
|
||||||
|
protected CacheSource<Long> sessions;
|
||||||
|
|
||||||
@Resource(name = "cacheSource")
|
@Resource(name = "cacheSource")
|
||||||
protected CacheSource cacheSource;
|
protected CacheSource cacheSource;
|
||||||
|
@ -88,6 +88,7 @@ public class BaseServlet extends HttpServlet {
|
|||||||
visLog.setIp(request.getRemoteAddr());
|
visLog.setIp(request.getRemoteAddr());
|
||||||
visLog.setUri(request.getRequestURI());
|
visLog.setUri(request.getRequestURI());
|
||||||
visLog.setHeaders(headers);
|
visLog.setHeaders(headers);
|
||||||
|
visLog.setUserid(userid);
|
||||||
visLog.setPara(para);
|
visLog.setPara(para);
|
||||||
visLog.setTime(System.currentTimeMillis());
|
visLog.setTime(System.currentTimeMillis());
|
||||||
visLog.setFtime(String.format("%1$tY%1$tm%1$td%1$tH%1$tM%1$tS", visLog.getTime()));
|
visLog.setFtime(String.format("%1$tY%1$tm%1$td%1$tH%1$tM%1$tS", visLog.getTime()));
|
||||||
|
@ -86,6 +86,8 @@ public class TaskQueue<T extends Object> extends BaseService implements Runnable
|
|||||||
|
|
||||||
//记录访问日志,如果是访问的文章详情:对文章访问数量更新
|
//记录访问日志,如果是访问的文章详情:对文章访问数量更新
|
||||||
if (task instanceof VisLog) {
|
if (task instanceof VisLog) {
|
||||||
|
System.out.println(task);
|
||||||
|
/* todo: 需要记录 访问日志,此处添加记录日志逻辑
|
||||||
ArangoKit.save(task).thenAcceptAsync((_task) -> {
|
ArangoKit.save(task).thenAcceptAsync((_task) -> {
|
||||||
VisLog visLog = (VisLog) _task;
|
VisLog visLog = (VisLog) _task;
|
||||||
//[访问量]
|
//[访问量]
|
||||||
@ -94,6 +96,7 @@ public class TaskQueue<T extends Object> extends BaseService implements Runnable
|
|||||||
updateViewNum(visLog);
|
updateViewNum(visLog);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.lxyer.bbs.base.entity;
|
package com.lxyer.bbs.base.entity;
|
||||||
|
|
||||||
|
import org.redkale.convert.json.JsonConvert;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -9,7 +11,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class VisLog {
|
public class VisLog {
|
||||||
private String ip;
|
private String ip;
|
||||||
private String userid;
|
private int userid;
|
||||||
private String ftime;
|
private String ftime;
|
||||||
private String uri;
|
private String uri;
|
||||||
private long time;
|
private long time;
|
||||||
@ -24,11 +26,11 @@ public class VisLog {
|
|||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserid() {
|
public int getUserid() {
|
||||||
return userid;
|
return userid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserid(String userid) {
|
public void setUserid(int userid) {
|
||||||
this.userid = userid;
|
this.userid = userid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,14 +76,6 @@ public class VisLog {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "VisLog{" +
|
return JsonConvert.root().convertTo(this);
|
||||||
"ip='" + ip + '\'' +
|
|
||||||
", userid='" + userid + '\'' +
|
|
||||||
", ftime='" + ftime + '\'' +
|
|
||||||
", uri='" + uri + '\'' +
|
|
||||||
", time=" + time +
|
|
||||||
", para=" + para +
|
|
||||||
", headers=" + headers +
|
|
||||||
'}';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class UserService extends BaseService {
|
|||||||
//log(user, 0, "用户登录成功.");
|
//log(user, 0, "用户登录成功.");
|
||||||
UserInfo userInfo = user.createUserInfo();
|
UserInfo userInfo = user.createUserInfo();
|
||||||
|
|
||||||
sessions.setAsync(sessionExpireSeconds, loginBean.getSessionid(), userInfo.getUserid());
|
sessions.setAsync(sessionExpireSeconds, loginBean.getSessionid(), (long)userInfo.getUserid());
|
||||||
retResult.setRetcode(0);
|
retResult.setRetcode(0);
|
||||||
retResult.setResult(userInfo);
|
retResult.setResult(userInfo);
|
||||||
retResult.setRetinfo("登录成功.");
|
retResult.setRetinfo("登录成功.");
|
||||||
|
@ -62,7 +62,7 @@ public class ContentServlet extends BaseServlet {
|
|||||||
/*Flipper flipper3 = new Flipper().limit(8).sort("replynum DESC");
|
/*Flipper flipper3 = new Flipper().limit(8).sort("replynum DESC");
|
||||||
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", sessionid);*/
|
Sheet<ContentInfo> hotReply = contentService.contentQuery(flipper3, "", sessionid);*/
|
||||||
|
|
||||||
Sheet<ContentInfo> hotView = logQueue.hotView(sessionid);
|
Sheet<ContentInfo> hotView = Sheet.empty();//logQueue.hotView(sessionid); TODO: 依赖日志记录,需记录日志后可使用
|
||||||
|
|
||||||
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)*/;
|
||||||
response.finish(HttpScope.refer("/jie/detail.html").attr(kv));
|
response.finish(HttpScope.refer("/jie/detail.html").attr(kv));
|
||||||
@ -87,7 +87,7 @@ public class ContentServlet extends BaseServlet {
|
|||||||
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, setPrivate(request, setPrivate(request, filterNode)));
|
Sheet<ContentInfo> contents = contentService.contentQuery(flipper, setPrivate(request, setPrivate(request, filterNode)));
|
||||||
|
|
||||||
//热帖
|
//热帖
|
||||||
Sheet<ContentInfo> hotView = logQueue.hotView(sessionid);
|
Sheet<ContentInfo> hotView = Sheet.empty();//logQueue.hotView(sessionid); TODO: 依赖日志记录,需记录日志后可使用
|
||||||
|
|
||||||
Kv kv = Kv.by("contents", contents).set("hotView", hotView)
|
Kv kv = Kv.by("contents", contents).set("hotView", hotView)
|
||||||
.set("solved", solved).set("wonderful", wonderful)
|
.set("solved", solved).set("wonderful", wonderful)
|
||||||
|
Loading…
Reference in New Issue
Block a user