feat:给日志追加当前时间

This commit is contained in:
liyuanhu 2025-05-12 15:28:00 +08:00
parent 176aa823b1
commit 8efc3f9b31
7 changed files with 40 additions and 22 deletions

16
.env
View File

@ -1,10 +1,10 @@
IS_DEBUG="true" IS_DEBUG="true"
GRPC_ENDPOINT="47.82.97.10:9090" GRPC_ENDPOINT="10.66.66.230:9090"
COSMOS_ENDPOINT="http://47.82.97.10:26657" COSMOS_ENDPOINT="http://10.66.66.230:26657"
ACCOUNT_NAME="bchrmll0jvrr" ACCOUNT_NAME="bltrj0xs"
TRAFFIC_OBFUSCATE="47.82.97.10:8180" TRAFFIC_OBFUSCATE="10.66.66.230:8180"
NODE_SECRET= "shell useless annual satisfy comfort bulk beyond own fly puzzle key shock grief depart capable purpose peasant model stamp city gain parent bright auto" NODE_SECRET= "protect curtain print mixed void mammal husband bamboo dinner butter beach off leader frost medal pig deputy orphan indoor wolf buyer emerge pause dog"
VIET_EVENTS_URL="ws://47.82.97.10:8080/events" VIET_EVENTS_URL="ws://10.66.66.230:8080/events"
VITE_BASE_URL="http://47.82.97.10:8080" VITE_BASE_URL="http://10.66.66.230:8080"
VITE_BLOCK_URL="http://47.82.97.10:1317" VITE_BLOCK_URL="http://10.66.66.230:1317"
NODE_OPTIONS=--max-old-space-size=8192 NODE_OPTIONS=--max-old-space-size=8192

View File

@ -6,6 +6,7 @@ import type { EChartsType } from "echarts";
import worldGeoJson from "@/assets/echarts-map/json/world.json"; import worldGeoJson from "@/assets/echarts-map/json/world.json";
import { geoCoordMap, countryNameMap, countryCodeMap } from "@/data"; import { geoCoordMap, countryNameMap, countryCodeMap } from "@/data";
import { getUrl } from "@/lib/utils"; import { getUrl } from "@/lib/utils";
import dayjs from "dayjs";
interface LinesItemType { interface LinesItemType {
name: string; name: string;
@ -45,7 +46,9 @@ const CustomTooltipLeft = ({
setIsComplete(false); setIsComplete(false);
// 先显示第一条日志 // 先显示第一条日志
setVisibleLogs([filteredLogs[0]]); setVisibleLogs([
`[${dayjs().format("YYYY-MM-DD HH:mm:ss")}] ${filteredLogs[0]}`,
]);
// 如果只有一条日志,直接设置完成 // 如果只有一条日志,直接设置完成
if (filteredLogs.length === 1) { if (filteredLogs.length === 1) {
@ -58,7 +61,10 @@ const CustomTooltipLeft = ({
const timer = setInterval(() => { const timer = setInterval(() => {
if (currentIndex < filteredLogs.length) { if (currentIndex < filteredLogs.length) {
setVisibleLogs((prev) => [...prev, filteredLogs[currentIndex]]); const curLog = `[${dayjs().format("YYYY-MM-DD HH:mm:ss")}] ${
filteredLogs[currentIndex]
}`;
setVisibleLogs((prev) => [...prev, curLog]);
currentIndex++; currentIndex++;
// 如果已经是最后一条,设置完成状态 // 如果已经是最后一条,设置完成状态
@ -70,7 +76,7 @@ const CustomTooltipLeft = ({
clearInterval(timer); clearInterval(timer);
setIsComplete(true); setIsComplete(true);
} }
}, 500); }, 1000);
// 清理函数 // 清理函数
return () => { return () => {

View File

@ -4,6 +4,7 @@ import type { EChartsType } from "echarts";
import worldGeoJson from "@/assets/echarts-map/json/world.json"; import worldGeoJson from "@/assets/echarts-map/json/world.json";
import { geoCoordMap, countryNameMap, countryCodeMap } from "@/data"; import { geoCoordMap, countryNameMap, countryCodeMap } from "@/data";
import { getUrl } from "@/lib/utils"; import { getUrl } from "@/lib/utils";
import dayjs from "dayjs";
// 连线动画的间隔时间(毫秒) // 连线动画的间隔时间(毫秒)
const LINE_ANIMATION_INTERVAL = 500; const LINE_ANIMATION_INTERVAL = 500;
@ -44,13 +45,14 @@ const CustomTooltip = ({
// 创建一个定时器每500毫秒显示一条新日志 // 创建一个定时器每500毫秒显示一条新日志
const timer = setInterval(() => { const timer = setInterval(() => {
if (currentIndex < logs.length) { if (currentIndex < logs.length) {
setVisibleLogs((prev) => [...prev, logs[currentIndex]]); const curLog = `[${dayjs().format("YYYY-MM-DD HH:mm:ss")}] ${logs[currentIndex]}`;
setVisibleLogs((prev) => [...prev, curLog]);
currentIndex++; currentIndex++;
} else { } else {
clearInterval(timer); clearInterval(timer);
setIsComplete(true); setIsComplete(true);
} }
}, 500); }, 1000);
// 清理函数 // 清理函数
return () => { return () => {

View File

@ -7,6 +7,7 @@ import worldGeoJson from "@/assets/echarts-map/json/world.json";
import { geoCoordMap, countryNameMap, countryCodeMap } from "@/data"; import { geoCoordMap, countryNameMap, countryCodeMap } from "@/data";
import { getUrl } from "@/lib/utils"; import { getUrl } from "@/lib/utils";
import { CONST_TOOLTIP_TYPE } from "@/pages/anti-forensics-forwarding"; import { CONST_TOOLTIP_TYPE } from "@/pages/anti-forensics-forwarding";
import dayjs from "dayjs";
interface LinesItemType { interface LinesItemType {
name: string; name: string;
@ -45,9 +46,10 @@ const CustomTooltip = ({
// 重置状态 // 重置状态
setVisibleLogs([]); setVisibleLogs([]);
setIsComplete(false); setIsComplete(false);
// 先显示第一条日志 // 先显示第一条日志
setVisibleLogs([filteredLogs[0]]); setVisibleLogs([
`[${dayjs().format("YYYY-MM-DD HH:mm:ss")}] ${filteredLogs[0]}`,
]);
// 如果只有一条日志,直接设置完成 // 如果只有一条日志,直接设置完成
if (filteredLogs.length === 1) { if (filteredLogs.length === 1) {
@ -60,7 +62,10 @@ const CustomTooltip = ({
const timer = setInterval(() => { const timer = setInterval(() => {
if (currentIndex < filteredLogs.length) { if (currentIndex < filteredLogs.length) {
setVisibleLogs((prev) => [...prev, filteredLogs[currentIndex]]); const curLog = `[${dayjs().format("YYYY-MM-DD HH:mm:ss")}] ${
filteredLogs[currentIndex]
}`;
setVisibleLogs((prev: any) => [...prev, curLog]);
currentIndex++; currentIndex++;
// 如果已经是最后一条,设置完成状态 // 如果已经是最后一条,设置完成状态
@ -72,7 +77,8 @@ const CustomTooltip = ({
clearInterval(timer); clearInterval(timer);
setIsComplete(true); setIsComplete(true);
} }
}, 500); console.log("visibleLogs", visibleLogs);
}, 1000);
// 清理函数 // 清理函数
return () => { return () => {
@ -204,7 +210,9 @@ const CustomTooltipLeft = ({
setIsComplete(false); setIsComplete(false);
// 先显示第一条日志 // 先显示第一条日志
setVisibleLogs([filteredLogs[0]]); setVisibleLogs([
`[${dayjs().format("YYYY-MM-DD HH:mm:ss")}] ${filteredLogs[0]}`,
]);
// 如果只有一条日志,直接设置完成 // 如果只有一条日志,直接设置完成
if (filteredLogs.length === 1) { if (filteredLogs.length === 1) {
@ -217,7 +225,10 @@ const CustomTooltipLeft = ({
const timer = setInterval(() => { const timer = setInterval(() => {
if (currentIndex < filteredLogs.length) { if (currentIndex < filteredLogs.length) {
setVisibleLogs((prev) => [...prev, filteredLogs[currentIndex]]); const curLog = `[${dayjs().format("YYYY-MM-DD HH:mm:ss")}] ${
filteredLogs[currentIndex]
}`;
setVisibleLogs((prev) => [...prev, curLog]);
currentIndex++; currentIndex++;
// 如果已经是最后一条,设置完成状态 // 如果已经是最后一条,设置完成状态
@ -229,7 +240,7 @@ const CustomTooltipLeft = ({
clearInterval(timer); clearInterval(timer);
setIsComplete(true); setIsComplete(true);
} }
}, 500); }, 1000);
// 清理函数 // 清理函数
return () => { return () => {
@ -400,14 +411,13 @@ export const WorldGeo = memo(
dataInfo.passAuthentication, dataInfo.passAuthentication,
...dataInfo.trafficObfuscation, ...dataInfo.trafficObfuscation,
...dataInfo.nestedEncryption, ...dataInfo.nestedEncryption,
...dataInfo.dynamicRouteGeneration, ...(dataInfo?.dynamicRouteGeneration || []),
]; ];
// 使用新的数据结构 // 使用新的数据结构
const proxiesList = const proxiesList =
selectedApp && selectedApp ? [...newList, selectedApp] : newList ?? []; selectedApp && selectedApp ? [...newList, selectedApp] : newList ?? [];
// 初始化数据数组 - 不再包含 startCountry // 初始化数据数组 - 不再包含 startCountry
const data: any = []; const data: any = [];
console.log(proxiesList, "proxiesList");
// 遍历代理列表 // 遍历代理列表
proxiesList.forEach((proxyItem: any) => { proxiesList.forEach((proxyItem: any) => {
// 检查是否有数据数组 // 检查是否有数据数组