.
This commit is contained in:
parent
3ce2ee4822
commit
ea421cc972
2
pom.xml
2
pom.xml
@ -7,8 +7,8 @@
|
|||||||
<groupId>com.lxyer</groupId>
|
<groupId>com.lxyer</groupId>
|
||||||
<artifactId>redbbs</artifactId>
|
<artifactId>redbbs</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<packaging>war</packaging>
|
|
||||||
<build>
|
<build>
|
||||||
|
<finalName>redbbs</finalName>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -40,7 +40,7 @@ public class ArangoService extends BaseService {
|
|||||||
|
|
||||||
//Arango
|
//Arango
|
||||||
protected static ArangoDB arangoDb;
|
protected static ArangoDB arangoDb;
|
||||||
protected static ArangoDatabase dbDev;
|
protected static ArangoDatabase db;
|
||||||
protected static ArangoCollection colVisLog;
|
protected static ArangoCollection colVisLog;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -48,11 +48,11 @@ public class ArangoService extends BaseService {
|
|||||||
System.out.println("isDev :" + isDev);
|
System.out.println("isDev :" + isDev);
|
||||||
|
|
||||||
arangoDb = new ArangoDB.Builder().host(arangoHost, port).user(user).password(password).build();
|
arangoDb = new ArangoDB.Builder().host(arangoHost, port).user(user).password(password).build();
|
||||||
dbDev = arangoDb.db(chDev.apply(database));
|
db = arangoDb.db(chDev.apply(database));
|
||||||
colVisLog = dbDev.collection(chDev.apply(VIS_LOG));
|
colVisLog = db.collection(chDev.apply(VIS_LOG));
|
||||||
|
|
||||||
if (!dbDev.exists()) {
|
if (!db.exists()) {
|
||||||
dbDev.create();
|
db.create();
|
||||||
}
|
}
|
||||||
if (!colVisLog.exists()) {
|
if (!colVisLog.exists()) {
|
||||||
colVisLog.create();
|
colVisLog.create();
|
||||||
@ -63,7 +63,7 @@ public class ArangoService extends BaseService {
|
|||||||
public List<Map> hi() {
|
public List<Map> hi() {
|
||||||
System.out.println("colVisLog :" + colVisLog.exists());
|
System.out.println("colVisLog :" + colVisLog.exists());
|
||||||
String aql = String.format("for d in %s limit 10 return d", chDev.apply(VIS_LOG));
|
String aql = String.format("for d in %s limit 10 return d", chDev.apply(VIS_LOG));
|
||||||
List<Map> visLogs = dbDev.query(aql, Map.class).asListRemaining();
|
List<Map> visLogs = db.query(aql, Map.class).asListRemaining();
|
||||||
return visLogs;
|
return visLogs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,19 +77,19 @@ public class ArangoService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static long findInt(String aql) {
|
public static long findInt(String aql) {
|
||||||
return dbDev.query(aql, long.class).first();
|
return db.query(aql, long.class).first();
|
||||||
}
|
}
|
||||||
public static long findInt(String aql, Map para) {
|
public static long findInt(String aql, Map para) {
|
||||||
return dbDev.query(aql, long.class).first();
|
return db.query(aql, long.class).first();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> List<T> find(String aql, Class<T> clazz) {
|
public static <T> List<T> find(String aql, Class<T> clazz) {
|
||||||
return dbDev.query(aql, clazz).asListRemaining();
|
return db.query(aql, clazz).asListRemaining();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> List<T> find(String aql, Map para, Class<T> clazz) {
|
public static <T> List<T> find(String aql, Map para, Class<T> clazz) {
|
||||||
|
|
||||||
return dbDev.query(aql, para, clazz).asListRemaining();
|
return db.query(aql, para, clazz).asListRemaining();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ public class TaskQueue<T extends Object> extends BaseService implements Runnable
|
|||||||
para.put("time", cal.getTimeInMillis());
|
para.put("time", cal.getTimeInMillis());
|
||||||
//查询一周某热帖记录
|
//查询一周某热帖记录
|
||||||
List<Count> hotArticle = ArangoService.find(
|
List<Count> hotArticle = ArangoService.find(
|
||||||
"for d in vis_log_dev\n" +
|
"for d in " + (isDev ? "vis_log_dev" : "vis_log") + "\n" +
|
||||||
" filter d.uri =~ '^/jie/detail/[0-9]+$' and d.userid != 100001 and d.time > @time\n" +
|
" filter d.uri =~ '^/jie/detail/[0-9]+$' and d.userid != 100001 and d.time > @time\n" +
|
||||||
" COLLECT uri=d.uri WITH COUNT INTO total\n" +
|
" COLLECT uri=d.uri WITH COUNT INTO total\n" +
|
||||||
" sort total desc\n" +
|
" sort total desc\n" +
|
||||||
|
Loading…
Reference in New Issue
Block a user