mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-06-10 23:47:29 +00:00
fix: CacheManager 消除双括号初始化,改用标准 HashMap 写法
This commit is contained in:
@@ -153,13 +153,13 @@ public class CacheManager {
|
|||||||
|
|
||||||
getShareKeyTotal(shareKey, fieldLower).onSuccess(total -> {
|
getShareKeyTotal(shareKey, fieldLower).onSuccess(total -> {
|
||||||
Integer newTotal = (total == null ? 0 : total) + 1;
|
Integer newTotal = (total == null ? 0 : total) + 1;
|
||||||
|
Map<String, Object> updateParams = new HashMap<>();
|
||||||
|
updateParams.put("panType", getShareType(shareKey));
|
||||||
|
updateParams.put("shareKey", shareKey);
|
||||||
|
updateParams.put("total", newTotal);
|
||||||
|
updateParams.put("ts", System.currentTimeMillis());
|
||||||
SqlTemplate.forUpdate(jdbcPool, sql)
|
SqlTemplate.forUpdate(jdbcPool, sql)
|
||||||
.execute(new HashMap<>() {{
|
.execute(updateParams)
|
||||||
put("panType", getShareType(shareKey));
|
|
||||||
put("shareKey", shareKey);
|
|
||||||
put("total", newTotal);
|
|
||||||
put("ts", System.currentTimeMillis());
|
|
||||||
}})
|
|
||||||
.onSuccess(res -> promise.complete(res.rowCount()))
|
.onSuccess(res -> promise.complete(res.rowCount()))
|
||||||
.onFailure(e->{
|
.onFailure(e->{
|
||||||
promise.fail(e);
|
promise.fail(e);
|
||||||
@@ -265,10 +265,9 @@ public class CacheManager {
|
|||||||
.onSuccess(res -> {
|
.onSuccess(res -> {
|
||||||
if(res.iterator().hasNext()) {
|
if(res.iterator().hasNext()) {
|
||||||
JsonObject next = res.iterator().next();
|
JsonObject next = res.iterator().next();
|
||||||
Map<String, Integer> resp = new HashMap<>(){{
|
Map<String, Integer> resp = new HashMap<>();
|
||||||
put("hit_total" ,next.getInteger("hit_total"));
|
resp.put("hit_total", next.getInteger("hit_total"));
|
||||||
put("parser_total" ,next.getInteger("parser_total"));
|
resp.put("parser_total", next.getInteger("parser_total"));
|
||||||
}};
|
|
||||||
promise.complete(resp);
|
promise.complete(resp);
|
||||||
} else {
|
} else {
|
||||||
promise.complete();
|
promise.complete();
|
||||||
|
|||||||
Reference in New Issue
Block a user