.
This commit is contained in:
parent
3ce2ee4822
commit
ea421cc972
2
pom.xml
2
pom.xml
@ -7,8 +7,8 @@
|
||||
<groupId>com.lxyer</groupId>
|
||||
<artifactId>redbbs</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
<build>
|
||||
<finalName>redbbs</finalName>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
@ -40,7 +40,7 @@ public class ArangoService extends BaseService {
|
||||
|
||||
//Arango
|
||||
protected static ArangoDB arangoDb;
|
||||
protected static ArangoDatabase dbDev;
|
||||
protected static ArangoDatabase db;
|
||||
protected static ArangoCollection colVisLog;
|
||||
|
||||
@Override
|
||||
@ -48,11 +48,11 @@ public class ArangoService extends BaseService {
|
||||
System.out.println("isDev :" + isDev);
|
||||
|
||||
arangoDb = new ArangoDB.Builder().host(arangoHost, port).user(user).password(password).build();
|
||||
dbDev = arangoDb.db(chDev.apply(database));
|
||||
colVisLog = dbDev.collection(chDev.apply(VIS_LOG));
|
||||
db = arangoDb.db(chDev.apply(database));
|
||||
colVisLog = db.collection(chDev.apply(VIS_LOG));
|
||||
|
||||
if (!dbDev.exists()) {
|
||||
dbDev.create();
|
||||
if (!db.exists()) {
|
||||
db.create();
|
||||
}
|
||||
if (!colVisLog.exists()) {
|
||||
colVisLog.create();
|
||||
@ -63,7 +63,7 @@ public class ArangoService extends BaseService {
|
||||
public List<Map> hi() {
|
||||
System.out.println("colVisLog :" + colVisLog.exists());
|
||||
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;
|
||||
}
|
||||
|
||||
@ -77,19 +77,19 @@ public class ArangoService extends BaseService {
|
||||
}
|
||||
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
|
||||
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());
|
||||
//查询一周某热帖记录
|
||||
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" +
|
||||
" COLLECT uri=d.uri WITH COUNT INTO total\n" +
|
||||
" sort total desc\n" +
|
||||
|
Loading…
Reference in New Issue
Block a user