mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-06-11 07:57:28 +00:00
refactor: 代码质量清理与日志规范化
- 替换 System.out.println/printStackTrace 为 Logger: MkgsTool, PodTool, WsTool, IpExtractor, ReqIpUtil, LogStatistics - JsPlaygroundLogger 日志列表限制最大 1000 条防止内存泄漏 - JsScriptLoader JarFile 改用 try-with-resources 防止文件句柄泄漏 - DbServiceImpl Thread.sleep 改为 vertx.setTimer 避免阻塞 event loop - 删除未使用的 api.js,删除空的 ParserApiClientLinkTest - 移除前端未使用的导入和死代码 (downloaderService, monacoTypes) - 提取 previewBaseUrl 到 constants.js 常量文件
This commit is contained in:
@@ -4,6 +4,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 演练场日志收集器
|
* 演练场日志收集器
|
||||||
* 收集JavaScript执行过程中的日志信息
|
* 收集JavaScript执行过程中的日志信息
|
||||||
@@ -13,7 +16,10 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class JsPlaygroundLogger {
|
public class JsPlaygroundLogger {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(JsPlaygroundLogger.class);
|
||||||
|
|
||||||
// 使用线程安全的列表
|
// 使用线程安全的列表
|
||||||
|
private static final int MAX_LOG_SIZE = 1000;
|
||||||
private final List<LogEntry> logs = Collections.synchronizedList(new ArrayList<>());
|
private final List<LogEntry> logs = Collections.synchronizedList(new ArrayList<>());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,6 +65,18 @@ public class JsPlaygroundLogger {
|
|||||||
return obj.toString();
|
return obj.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加日志条目,超过最大容量时移除最早的条目
|
||||||
|
*/
|
||||||
|
private void addLog(LogEntry entry) {
|
||||||
|
synchronized (logs) {
|
||||||
|
if (logs.size() >= MAX_LOG_SIZE) {
|
||||||
|
logs.remove(0);
|
||||||
|
}
|
||||||
|
logs.add(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 记录日志(内部方法)
|
* 记录日志(内部方法)
|
||||||
* @param level 日志级别
|
* @param level 日志级别
|
||||||
@@ -67,8 +85,8 @@ public class JsPlaygroundLogger {
|
|||||||
*/
|
*/
|
||||||
private void log(String level, Object message, String source) {
|
private void log(String level, Object message, String source) {
|
||||||
String msg = toString(message);
|
String msg = toString(message);
|
||||||
logs.add(new LogEntry(level, msg, source));
|
addLog(new LogEntry(level, msg, source));
|
||||||
System.out.println("[" + source + "PlaygroundLogger] " + level + ": " + msg);
|
log.debug("[{}PlaygroundLogger] {}: {}", source, level, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,8 +129,8 @@ public class JsPlaygroundLogger {
|
|||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
msg = msg + ": " + throwable.getMessage();
|
msg = msg + ": " + throwable.getMessage();
|
||||||
}
|
}
|
||||||
logs.add(new LogEntry("ERROR", msg, "JS"));
|
addLog(new LogEntry("ERROR", msg, "JS"));
|
||||||
System.out.println("[JSPlaygroundLogger] ERROR: " + msg);
|
log.debug("[JSPlaygroundLogger] ERROR: {}", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===== 以下是供Java层调用的内部方法 =====
|
// ===== 以下是供Java层调用的内部方法 =====
|
||||||
@@ -153,8 +171,8 @@ public class JsPlaygroundLogger {
|
|||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
msg = msg + ": " + throwable.getMessage();
|
msg = msg + ": " + throwable.getMessage();
|
||||||
}
|
}
|
||||||
logs.add(new LogEntry("ERROR", msg, "JAVA"));
|
addLog(new LogEntry("ERROR", msg, "JAVA"));
|
||||||
System.out.println("[JAVAPlaygroundLogger] ERROR: " + msg);
|
log.debug("[JAVAPlaygroundLogger] ERROR: {}", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -139,8 +139,8 @@ public class JsScriptLoader {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
String jarPath = jarUrl.getPath().substring(5, jarUrl.getPath().indexOf("!"));
|
String jarPath = jarUrl.getPath().substring(5, jarUrl.getPath().indexOf("!"));
|
||||||
JarFile jarFile = new JarFile(jarPath);
|
|
||||||
|
|
||||||
|
try (JarFile jarFile = new JarFile(jarPath)) {
|
||||||
Enumeration<JarEntry> entries = jarFile.entries();
|
Enumeration<JarEntry> entries = jarFile.entries();
|
||||||
while (entries.hasMoreElements()) {
|
while (entries.hasMoreElements()) {
|
||||||
JarEntry entry = entries.nextElement();
|
JarEntry entry = entries.nextElement();
|
||||||
@@ -152,8 +152,7 @@ public class JsScriptLoader {
|
|||||||
resourceFiles.add(entryName);
|
resourceFiles.add(entryName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
jarFile.close();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.debug("解析JAR包资源文件失败", e);
|
log.debug("解析JAR包资源文件失败", e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,10 +86,10 @@ public class MkgsTool extends PanBase {
|
|||||||
// 查找并输出 hash 字段的值
|
// 查找并输出 hash 字段的值
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
String hashValue = matcher.group(1); // 获取第一个捕获组
|
String hashValue = matcher.group(1); // 获取第一个捕获组
|
||||||
System.out.println(hashValue);
|
log.debug("hash: {}", hashValue);
|
||||||
client.getAbs(UriTemplate.of(API_URL)).setTemplateParam("hash", hashValue).send().onSuccess(res3 -> {
|
client.getAbs(UriTemplate.of(API_URL)).setTemplateParam("hash", hashValue).send().onSuccess(res3 -> {
|
||||||
JsonObject jsonObject = asJson(res3);
|
JsonObject jsonObject = asJson(res3);
|
||||||
System.out.println(jsonObject.encodePrettily());
|
log.debug("API response: {}", jsonObject.encodePrettily());
|
||||||
if (jsonObject.containsKey("url")) {
|
if (jsonObject.containsKey("url")) {
|
||||||
promise.complete(jsonObject.getString("url"));
|
promise.complete(jsonObject.getString("url"));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public class PodTool extends PanBase {
|
|||||||
|
|
||||||
if (urlMatcher.find()) {
|
if (urlMatcher.find()) {
|
||||||
String url = urlMatcher.group("url");
|
String url = urlMatcher.group("url");
|
||||||
System.out.println("URL: " + url);
|
log.debug("URL: {}", url);
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
throw new RuntimeException("URL匹配失败");
|
throw new RuntimeException("URL匹配失败");
|
||||||
@@ -172,7 +172,7 @@ public class PodTool extends PanBase {
|
|||||||
|
|
||||||
if (tokenMatcher.find()) {
|
if (tokenMatcher.find()) {
|
||||||
String token = tokenMatcher.group(1);
|
String token = tokenMatcher.group(1);
|
||||||
System.out.println("Token: " + token);
|
log.debug("Token: {}***", token.length() > 4 ? token.substring(0, 4) : "***");
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
throw new RuntimeException("token匹配失败");
|
throw new RuntimeException("token匹配失败");
|
||||||
@@ -198,8 +198,8 @@ public class PodTool extends PanBase {
|
|||||||
// 发送请求并处理响应
|
// 发送请求并处理响应
|
||||||
client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
|
client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
|
||||||
.thenApply(response -> {
|
.thenApply(response -> {
|
||||||
System.out.println("Response Status Code: " + response.statusCode());
|
log.debug("Response Status Code: {}", response.statusCode());
|
||||||
System.out.println("Response Body: " + response.body());
|
log.debug("Response Body: {}", response.body());
|
||||||
promise.complete(response.body());
|
promise.complete(response.body());
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -67,11 +67,7 @@ public class WsTool extends PanBase {
|
|||||||
String filepid = asJson(res2).getJsonObject("data").getString("ufileid"); // 文件夹pid
|
String filepid = asJson(res2).getJsonObject("data").getString("ufileid"); // 文件夹pid
|
||||||
String filebid = asJson(res2).getJsonObject("data").getString("boxid"); // 文件夹bid
|
String filebid = asJson(res2).getJsonObject("data").getString("boxid"); // 文件夹bid
|
||||||
|
|
||||||
// 调试输出文件夹信息
|
log.debug("文件夹期限: {}, 大小: {}, pid: {}, bid: {}", filetime, filesize, filepid, filebid);
|
||||||
System.out.println("文件夹期限: " + filetime);
|
|
||||||
System.out.println("文件夹大小: " + filesize);
|
|
||||||
System.out.println("文件夹pid: " + filepid);
|
|
||||||
System.out.println("文件夹bid: " + filebid);
|
|
||||||
|
|
||||||
// 获取文件信息
|
// 获取文件信息
|
||||||
httpClient.postAbs(SHARE_URL_API + "ufile/list").putHeaders(headers)
|
httpClient.postAbs(SHARE_URL_API + "ufile/list").putHeaders(headers)
|
||||||
@@ -97,9 +93,7 @@ public class WsTool extends PanBase {
|
|||||||
String filefid = asJson(res3).getJsonObject("data")
|
String filefid = asJson(res3).getJsonObject("data")
|
||||||
.getJsonArray("fileList").getJsonObject(0).getString("fid"); // 文件fid
|
.getJsonArray("fileList").getJsonObject(0).getString("fid"); // 文件fid
|
||||||
|
|
||||||
// 调试输出文件信息
|
log.debug("文件名称: {}, fid: {}", filename, filefid);
|
||||||
System.out.println("文件名称: " + filename);
|
|
||||||
System.out.println("文件fid: " + filefid);
|
|
||||||
|
|
||||||
// 检查文件是否失效
|
// 检查文件是否失效
|
||||||
httpClient.postAbs(SHARE_URL_API + "dl/sign").putHeaders(headers)
|
httpClient.postAbs(SHARE_URL_API + "dl/sign").putHeaders(headers)
|
||||||
@@ -114,8 +108,7 @@ public class WsTool extends PanBase {
|
|||||||
// 获取直链
|
// 获取直链
|
||||||
String fileurl = asJson(res4).getJsonObject("data").getString("url");
|
String fileurl = asJson(res4).getJsonObject("data").getString("url");
|
||||||
|
|
||||||
// 调试输出文件直链
|
log.debug("文件直链: {}", fileurl);
|
||||||
System.out.println("文件直链: " + fileurl);
|
|
||||||
|
|
||||||
if (!fileurl.equals("")) {
|
if (!fileurl.equals("")) {
|
||||||
promise.complete(URLDecoder.decode(fileurl, StandardCharsets.UTF_8));
|
promise.complete(URLDecoder.decode(fileurl, StandardCharsets.UTF_8));
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import io.vertx.core.Vertx;
|
|||||||
import io.vertx.core.http.impl.headers.HeadersMultiMap;
|
import io.vertx.core.http.impl.headers.HeadersMultiMap;
|
||||||
import io.vertx.ext.web.client.WebClient;
|
import io.vertx.ext.web.client.WebClient;
|
||||||
import io.vertx.ext.web.client.WebClientSession;
|
import io.vertx.ext.web.client.WebClientSession;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -15,6 +17,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class IpExtractor {
|
public class IpExtractor {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(IpExtractor.class);
|
||||||
|
|
||||||
public static void main(String[] args) throws InterruptedException {
|
public static void main(String[] args) throws InterruptedException {
|
||||||
|
|
||||||
|
|
||||||
@@ -42,9 +46,9 @@ public class IpExtractor {
|
|||||||
WebClient client = WebClient.create(Vertx.vertx());
|
WebClient client = WebClient.create(Vertx.vertx());
|
||||||
WebClientSession webClientSession = WebClientSession.create(client);
|
WebClientSession webClientSession = WebClientSession.create(client);
|
||||||
webClientSession.getAbs("https://ip.ihuan.me").putHeaders(headers).send().onSuccess(res->{
|
webClientSession.getAbs("https://ip.ihuan.me").putHeaders(headers).send().onSuccess(res->{
|
||||||
System.out.println(res.toString());
|
log.debug("response: {}", res.toString());
|
||||||
webClientSession.getAbs("https://ip.ihuan.me").putHeaders(headers).send().onSuccess(res2->{
|
webClientSession.getAbs("https://ip.ihuan.me").putHeaders(headers).send().onSuccess(res2->{
|
||||||
System.out.println(res2.toString());
|
log.debug("response2: {}", res2.toString());
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,15 +8,19 @@ import io.vertx.core.http.impl.headers.HeadersMultiMap;
|
|||||||
import io.vertx.ext.web.client.HttpResponse;
|
import io.vertx.ext.web.client.HttpResponse;
|
||||||
import io.vertx.ext.web.client.WebClient;
|
import io.vertx.ext.web.client.WebClient;
|
||||||
import io.vertx.ext.web.client.WebClientSession;
|
import io.vertx.ext.web.client.WebClientSession;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class ReqIpUtil {
|
public class ReqIpUtil {
|
||||||
public static String BASE_URL = "https://ip.ihuan.me";
|
private static final Logger log = LoggerFactory.getLogger(ReqIpUtil.class);
|
||||||
public static String BASE_URL_TEMPLATE = BASE_URL + "/{path}";
|
|
||||||
|
public static final String BASE_URL = "https://ip.ihuan.me";
|
||||||
|
public static final String BASE_URL_TEMPLATE = BASE_URL + "/{path}";
|
||||||
|
|
||||||
// GET https://ip.ihuan.me/mouse.do -> $("input[name='key']").val("30b4975b5547fed806bd2b9caa18485a");
|
// GET https://ip.ihuan.me/mouse.do -> $("input[name='key']").val("30b4975b5547fed806bd2b9caa18485a");
|
||||||
public static String PATH1 = "mouse.do";
|
public static final String PATH1 = "mouse.do";
|
||||||
|
|
||||||
public static String PATH2 = "tqdl.html";
|
public static final String PATH2 = "tqdl.html";
|
||||||
|
|
||||||
// 创建请求头Map
|
// 创建请求头Map
|
||||||
static MultiMap headers = new HeadersMultiMap();
|
static MultiMap headers = new HeadersMultiMap();
|
||||||
@@ -58,15 +62,15 @@ public class ReqIpUtil {
|
|||||||
|
|
||||||
void next(AsyncResult<HttpResponse<Buffer>> response) {
|
void next(AsyncResult<HttpResponse<Buffer>> response) {
|
||||||
if (response.failed()) {
|
if (response.failed()) {
|
||||||
response.cause().printStackTrace();
|
log.error("请求失败", response.cause());
|
||||||
} else {
|
} else {
|
||||||
HttpResponse<Buffer> res = response.result();
|
HttpResponse<Buffer> res = response.result();
|
||||||
System.out.println("Received response with status code " + res.statusCode());
|
log.debug("Received response with status code {}", res.statusCode());
|
||||||
System.out.println("Body: " + res.body());
|
log.debug("Body: {}", res.body());
|
||||||
webClientSession.getAbs(BASE_URL_TEMPLATE).setTemplateParam("path", PATH1)
|
webClientSession.getAbs(BASE_URL_TEMPLATE).setTemplateParam("path", PATH1)
|
||||||
.putHeaders(headers) // 将请求头Map添加到请求中
|
.putHeaders(headers) // 将请求头Map添加到请求中
|
||||||
.send(response2 -> {
|
.send(response2 -> {
|
||||||
System.out.println(response2.result().bodyAsString());
|
log.debug("response2: {}", response2.result().bodyAsString());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,125 +0,0 @@
|
|||||||
import axios from 'axios'
|
|
||||||
|
|
||||||
// 创建 axios 实例
|
|
||||||
const api = axios.create({
|
|
||||||
baseURL: process.env.VUE_APP_API_BASE_URL || 'http://localhost:6400',
|
|
||||||
timeout: 30000,
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// 请求拦截器
|
|
||||||
api.interceptors.request.use(
|
|
||||||
config => {
|
|
||||||
// 可以在这里添加认证token等
|
|
||||||
return config
|
|
||||||
},
|
|
||||||
error => {
|
|
||||||
return Promise.reject(error)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// 响应拦截器
|
|
||||||
api.interceptors.response.use(
|
|
||||||
response => {
|
|
||||||
return response.data
|
|
||||||
},
|
|
||||||
error => {
|
|
||||||
console.error('API请求错误:', error)
|
|
||||||
|
|
||||||
if (error.response) {
|
|
||||||
// 服务器返回错误状态码
|
|
||||||
const message = error.response.data?.message || error.response.data?.error || '服务器错误'
|
|
||||||
return Promise.reject(new Error(message))
|
|
||||||
} else if (error.request) {
|
|
||||||
// 网络错误
|
|
||||||
return Promise.reject(new Error('网络连接失败,请检查网络设置'))
|
|
||||||
} else {
|
|
||||||
// 其他错误
|
|
||||||
return Promise.reject(new Error(error.message || '请求失败'))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// 客户端链接 API
|
|
||||||
export const clientLinksApi = {
|
|
||||||
/**
|
|
||||||
* 获取所有客户端下载链接
|
|
||||||
* @param {string} shareUrl - 分享链接
|
|
||||||
* @param {string} password - 提取码(可选)
|
|
||||||
* @returns {Promise} 客户端链接响应
|
|
||||||
*/
|
|
||||||
async getClientLinks(shareUrl, password = '') {
|
|
||||||
const params = new URLSearchParams()
|
|
||||||
params.append('url', shareUrl)
|
|
||||||
if (password) {
|
|
||||||
params.append('pwd', password)
|
|
||||||
}
|
|
||||||
|
|
||||||
return await api.get(`/v2/clientLinks?${params.toString()}`)
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取指定类型的客户端下载链接
|
|
||||||
* @param {string} shareUrl - 分享链接
|
|
||||||
* @param {string} password - 提取码(可选)
|
|
||||||
* @param {string} clientType - 客户端类型
|
|
||||||
* @returns {Promise} 指定类型的客户端链接
|
|
||||||
*/
|
|
||||||
async getClientLink(shareUrl, password = '', clientType) {
|
|
||||||
const params = new URLSearchParams()
|
|
||||||
params.append('url', shareUrl)
|
|
||||||
if (password) {
|
|
||||||
params.append('pwd', password)
|
|
||||||
}
|
|
||||||
params.append('clientType', clientType)
|
|
||||||
|
|
||||||
return await api.get(`/v2/clientLink?${params.toString()}`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 其他 API(如果需要的话)
|
|
||||||
export const parserApi = {
|
|
||||||
/**
|
|
||||||
* 解析分享链接
|
|
||||||
* @param {string} shareUrl - 分享链接
|
|
||||||
* @param {string} password - 提取码(可选)
|
|
||||||
* @returns {Promise} 解析结果
|
|
||||||
*/
|
|
||||||
async parseLink(shareUrl, password = '') {
|
|
||||||
const params = new URLSearchParams()
|
|
||||||
params.append('url', shareUrl)
|
|
||||||
if (password) {
|
|
||||||
params.append('pwd', password)
|
|
||||||
}
|
|
||||||
|
|
||||||
return await api.get(`/v2/linkInfo?${params.toString()}`)
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取文件列表
|
|
||||||
* @param {string} shareUrl - 分享链接
|
|
||||||
* @param {string} password - 提取码(可选)
|
|
||||||
* @param {string} dirId - 目录ID(可选)
|
|
||||||
* @param {string} uuid - UUID(可选)
|
|
||||||
* @returns {Promise} 文件列表
|
|
||||||
*/
|
|
||||||
async getFileList(shareUrl, password = '', dirId = '', uuid = '') {
|
|
||||||
const params = new URLSearchParams()
|
|
||||||
params.append('url', shareUrl)
|
|
||||||
if (password) {
|
|
||||||
params.append('pwd', password)
|
|
||||||
}
|
|
||||||
if (dirId) {
|
|
||||||
params.append('dirId', dirId)
|
|
||||||
}
|
|
||||||
if (uuid) {
|
|
||||||
params.append('uuid', uuid)
|
|
||||||
}
|
|
||||||
|
|
||||||
return await api.get(`/v2/getFileList?${params.toString()}`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default api
|
|
||||||
6
web-front/src/utils/constants.js
Normal file
6
web-front/src/utils/constants.js
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* 前端全局常量
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** 预览服务基础 URL */
|
||||||
|
export const PREVIEW_BASE_URL = 'https://nfd-parser.github.io/nfd-preview/preview.html?src='
|
||||||
@@ -410,7 +410,6 @@ function addThunderDownload(tasks, config) {
|
|||||||
if (userAgent) taskParam.userAgent = userAgent
|
if (userAgent) taskParam.userAgent = userAgent
|
||||||
taskParam.threadCount = '1'
|
taskParam.threadCount = '1'
|
||||||
|
|
||||||
console.log('[Thunder SDK] newTask params:', JSON.stringify(taskParam))
|
|
||||||
window.thunderLink.newTask(taskParam)
|
window.thunderLink.newTask(taskParam)
|
||||||
return Promise.resolve('thunder-ok')
|
return Promise.resolve('thunder-ok')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -313,7 +313,6 @@ export async function loadTypesFromApi(monaco) {
|
|||||||
cachedContent,
|
cachedContent,
|
||||||
'file:///types.js'
|
'file:///types.js'
|
||||||
);
|
);
|
||||||
console.log('从缓存加载types.js成功');
|
|
||||||
// 异步更新缓存
|
// 异步更新缓存
|
||||||
updateTypesJsCache();
|
updateTypesJsCache();
|
||||||
return;
|
return;
|
||||||
@@ -334,7 +333,6 @@ export async function loadTypesFromApi(monaco) {
|
|||||||
typesJsContent,
|
typesJsContent,
|
||||||
'file:///types.js'
|
'file:///types.js'
|
||||||
);
|
);
|
||||||
console.log('加载types.js成功并已缓存');
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn('加载types.js失败,使用内置类型定义:', error);
|
console.warn('加载types.js失败,使用内置类型定义:', error);
|
||||||
@@ -350,7 +348,6 @@ async function updateTypesJsCache() {
|
|||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const typesJsContent = await response.text();
|
const typesJsContent = await response.text();
|
||||||
localStorage.setItem('playground_types_js', typesJsContent);
|
localStorage.setItem('playground_types_js', typesJsContent);
|
||||||
console.log('types.js缓存已更新');
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn('更新types.js缓存失败:', error);
|
console.warn('更新types.js缓存失败:', error);
|
||||||
|
|||||||
@@ -48,6 +48,6 @@ public class LogStatistics implements AfterInterceptor {
|
|||||||
.execute(info)
|
.execute(info)
|
||||||
.onSuccess(res -> {
|
.onSuccess(res -> {
|
||||||
log.info("inserted log: id={}, path={}, code={}", info.getId(), info.getPath(), info.getCode());
|
log.info("inserted log: id={}, path={}, code={}", info.getId(), info.getPath(), info.getCode());
|
||||||
}).onFailure(Throwable::printStackTrace);
|
}).onFailure(e -> log.error("插入解析日志失败: id={}", info.getId(), e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,12 +42,11 @@ public class DbServiceImpl implements DbService {
|
|||||||
@Override
|
@Override
|
||||||
public Future<JsonObject> sayOk(String data) {
|
public Future<JsonObject> sayOk(String data) {
|
||||||
log.info("say ok1 -> wait...");
|
log.info("say ok1 -> wait...");
|
||||||
try {
|
Promise<JsonObject> promise = Promise.promise();
|
||||||
Thread.sleep(4000);
|
cn.qaiu.vx.core.util.VertxHolder.getVertxInstance().setTimer(4000, id -> {
|
||||||
} catch (InterruptedException e) {
|
promise.complete(JsonObject.mapFrom(JsonResult.data("Hi: " + data)));
|
||||||
e.printStackTrace();
|
});
|
||||||
}
|
return promise.future();
|
||||||
return Future.succeededFuture(JsonObject.mapFrom(JsonResult.data("Hi: " + data)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user