This commit is contained in:
2019-03-01 22:04:41 +08:00
parent bd59b4f24c
commit b5506e07e7
14 changed files with 53 additions and 67 deletions

View File

@@ -15,6 +15,7 @@ import org.redkale.source.FilterNode;
import org.redkale.source.Flipper;
import org.redkale.util.Comment;
import org.redkale.util.Sheet;
import org.redkale.util.Utility;
import javax.annotation.Resource;
import java.util.*;
@@ -57,8 +58,7 @@ public class TaskQueue<T extends Object> extends BaseService implements Runnable
//记录访问日志,如果是访问的文章详情:对文章访问数量更新
if (task instanceof VisLog) {
System.out.println(task);
/* todo: 需要记录 访问日志,此处添加记录日志逻辑
//System.out.println(task);
ArangoService.save(task).thenAcceptAsync((_task) -> {
VisLog visLog = (VisLog) _task;
//[访问量]
@@ -67,7 +67,6 @@ public class TaskQueue<T extends Object> extends BaseService implements Runnable
updateViewNum(visLog);
}
});
*/
}
} catch (InterruptedException e) {
@@ -84,7 +83,7 @@ public class TaskQueue<T extends Object> extends BaseService implements Runnable
" collect WITH COUNT INTO total\n" +
" return total", visLog.getUri(), visLog.getIp(), visLog.getUserid());
long total = 2;//ArangoService.findInt(aql);
long total = ArangoService.findInt(aql);
if (total <= 1) {
String uri = visLog.getUri();
@@ -97,16 +96,14 @@ public class TaskQueue<T extends Object> extends BaseService implements Runnable
public Sheet<ContentInfo> hotView(String sessionid){
int limit = 8;
String cacheKey = "hotView";
Object ids = null;//cacheSource.get(cacheKey);
if (ids == null){
Object ids = cacheSource.get(cacheKey);
if (isEmpty.test(ids)){
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_MONTH, -7);
Map para = new HashMap();
para.put("time", cal.getTimeInMillis());
//查询一周某热帖记录
List<Count> hotArticle = new ArrayList<>();
/* TODO: 依赖日志记录,需记录日志后可使用
List<Count> hotArticle = ArangoService.find(
"for d in vis_log_dev\n" +
" filter d.uri =~ '^/jie/detail/[0-9]+$' and d.userid != 100001 and d.time > @time\n" +
@@ -115,7 +112,7 @@ public class TaskQueue<T extends Object> extends BaseService implements Runnable
" limit 10\n" +
" return {name: uri,total:total}",
Utility.ofMap("time", cal.getTimeInMillis()),
Count.class);*/
Count.class);
Function<List<Count>, List<Integer>> deal = (counts) -> {
List<Integer> _ids = new ArrayList<>();