mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-02-24 14:15:24 +00:00
MySQL支持, 其他优化
This commit is contained in:
@@ -21,13 +21,13 @@ public class ApiStatisticsInfo implements ToJson {
|
||||
/**
|
||||
* pan type 单独拿出来便于统计.
|
||||
*/
|
||||
@Length(varcharSize = 4)
|
||||
@Length(varcharSize = 16)
|
||||
private String panType;
|
||||
|
||||
/**
|
||||
* 分享key type:key
|
||||
*/
|
||||
@Length(varcharSize = 4096)
|
||||
@Length(varcharSize = 1024)
|
||||
private String shareKey;
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,7 @@ public class CacheLinkInfo implements ToJson {
|
||||
/**
|
||||
* 缓存key: type:ShareKey; e.g. lz:xxxx
|
||||
*/
|
||||
@Length(varcharSize = 4096)
|
||||
@Length(varcharSize = 1024)
|
||||
private String shareKey;
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,10 +48,11 @@ public class DbServiceImpl implements DbService {
|
||||
JDBCPool client = JDBCPoolInit.instance().getPool();
|
||||
Promise<StatisticsInfo> promise = Promise.promise();
|
||||
String sql = """
|
||||
select sum(api_parser_total) parserTotal,sum("cache_hit_total") cacheTotal,
|
||||
sum(api_parser_total) + sum("cache_hit_total") total
|
||||
from "api_statistics_info";
|
||||
select sum(api_parser_total) as parserTotal, sum(cache_hit_total) as cacheTotal,
|
||||
sum(api_parser_total) + sum(cache_hit_total) as total
|
||||
from api_statistics_info;
|
||||
""";
|
||||
|
||||
SqlTemplate.forQuery(client, sql).mapTo(StatisticsInfo.class).execute(new HashMap<>()).onSuccess(row -> {
|
||||
StatisticsInfo info;
|
||||
if ((info = row.iterator().next()) != null) {
|
||||
@@ -59,7 +60,10 @@ public class DbServiceImpl implements DbService {
|
||||
} else {
|
||||
promise.fail("t_parser_log_info查询为空");
|
||||
}
|
||||
}).onFailure(promise::fail);
|
||||
}).onFailure(e->{
|
||||
log.error("getStatisticsInfo: ", e);
|
||||
promise.fail(e);
|
||||
});
|
||||
return promise.future();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user