koishi-plugin-jscn-aaaquery 1.0.14 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +56 -75
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -51,21 +51,21 @@ function evaluateOpticalPower(power) {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
__name(evaluateOpticalPower, "evaluateOpticalPower");
|
|
54
|
-
var CACHE_EXPIRE_TIME =
|
|
54
|
+
var CACHE_EXPIRE_TIME = 1 * 60 * 1e3;
|
|
55
55
|
var CACHE_CLEAN_INTERVAL = 60 * 1e3;
|
|
56
56
|
var CACHE_STATS_RESET_INTERVAL = 24 * 60 * 60 * 1e3;
|
|
57
|
-
var QUEUE_EXPIRE_TIME =
|
|
57
|
+
var QUEUE_EXPIRE_TIME = 1 * 60 * 1e3;
|
|
58
58
|
var QUEUE_CLEAN_INTERVAL = 30 * 1e3;
|
|
59
59
|
var MAX_CONCURRENT_REQUESTS = 5;
|
|
60
|
-
var MESSAGE_TIMEOUT =
|
|
60
|
+
var MESSAGE_TIMEOUT = 1 * 60 * 1e3;
|
|
61
61
|
var MESSAGE_CLEAN_INTERVAL = 60 * 1e3;
|
|
62
62
|
function apply(ctx, config) {
|
|
63
|
-
const CACHE_EXPIRATION =
|
|
64
|
-
const CACHE_CLEANUP_INTERVAL =
|
|
63
|
+
const CACHE_EXPIRATION = 1 * 60 * 1e3;
|
|
64
|
+
const CACHE_CLEANUP_INTERVAL = 5 * 60 * 1e3;
|
|
65
65
|
const CACHE_STATS_RESET_INTERVAL2 = 24 * 60 * 60 * 1e3;
|
|
66
|
-
const REQUEST_QUEUE_EXPIRATION =
|
|
67
|
-
const REQUEST_QUEUE_CLEANUP_INTERVAL =
|
|
68
|
-
const TOKEN_REFRESH_THRESHOLD =
|
|
66
|
+
const REQUEST_QUEUE_EXPIRATION = 1 * 60 * 1e3;
|
|
67
|
+
const REQUEST_QUEUE_CLEANUP_INTERVAL = 5 * 60 * 1e3;
|
|
68
|
+
const TOKEN_REFRESH_THRESHOLD = 30 * 60 * 1e3;
|
|
69
69
|
let currentToken = null;
|
|
70
70
|
let tokenExpireTime = 0;
|
|
71
71
|
const requestQueue = {};
|
|
@@ -83,7 +83,7 @@ function apply(ctx, config) {
|
|
|
83
83
|
const requestWaitQueue = [];
|
|
84
84
|
const messageQueue = [];
|
|
85
85
|
let isProcessingMessage = false;
|
|
86
|
-
const MESSAGE_TIMEOUT2 =
|
|
86
|
+
const MESSAGE_TIMEOUT2 = 1 * 60 * 1e3;
|
|
87
87
|
const MESSAGE_CLEAN_INTERVAL2 = 60 * 1e3;
|
|
88
88
|
const MAX_QUEUE_LENGTH = 50;
|
|
89
89
|
function getCacheKey(type, params) {
|
|
@@ -309,11 +309,6 @@ function apply(ctx, config) {
|
|
|
309
309
|
__name(refreshToken, "refreshToken");
|
|
310
310
|
async function queryAccount(account) {
|
|
311
311
|
const formattedAccount = formatAccount(account);
|
|
312
|
-
const cachedData = getFromCache("account", { account: formattedAccount });
|
|
313
|
-
if (cachedData) {
|
|
314
|
-
console.log("使用缓存的账号信息");
|
|
315
|
-
return cachedData;
|
|
316
|
-
}
|
|
317
312
|
return addToQueue("account", { account: formattedAccount }, async () => {
|
|
318
313
|
let retryCount = 0;
|
|
319
314
|
const maxRetries = 1;
|
|
@@ -338,7 +333,6 @@ function apply(ctx, config) {
|
|
|
338
333
|
if (!response.data.maxDownSpeed) response.data.maxDownSpeed = 0;
|
|
339
334
|
if (!response.data.startTime) response.data.startTime = response.data.onlineFailTime || "未知";
|
|
340
335
|
if (!response.data.nickName) response.data.nickName = response.data.nickName || "未知";
|
|
341
|
-
setCache("account", { account: formattedAccount }, response.data);
|
|
342
336
|
return response.data;
|
|
343
337
|
}
|
|
344
338
|
if (response.data.onlineStatus === "离线" || response.data.onlineStatus === "不在线" || response.data.isPass === "原因未知") {
|
|
@@ -351,13 +345,11 @@ function apply(ctx, config) {
|
|
|
351
345
|
if (!response.data.mac) response.data.mac = "未知";
|
|
352
346
|
if (!response.data.userIp) response.data.userIp = "未知";
|
|
353
347
|
if (!response.data.accessDomain) response.data.accessDomain = "未知";
|
|
354
|
-
setCache("account", { account: formattedAccount }, response.data);
|
|
355
348
|
return response.data;
|
|
356
349
|
}
|
|
357
350
|
if (!isAccountResponseComplete(response.data)) {
|
|
358
351
|
throw new Error("账号信息有误,请检查账号是否正确");
|
|
359
352
|
}
|
|
360
|
-
setCache("account", { account: formattedAccount }, response.data);
|
|
361
353
|
return response.data;
|
|
362
354
|
}
|
|
363
355
|
throw new Error(`查询失败:${response.message || "未知错误"}`);
|
|
@@ -426,11 +418,6 @@ function apply(ctx, config) {
|
|
|
426
418
|
}
|
|
427
419
|
__name(queryAccountDetail, "queryAccountDetail");
|
|
428
420
|
async function queryOnuList(mac) {
|
|
429
|
-
const cachedData = getFromCache("onuList", { mac });
|
|
430
|
-
if (cachedData) {
|
|
431
|
-
console.log("使用缓存的设备信息");
|
|
432
|
-
return cachedData;
|
|
433
|
-
}
|
|
434
421
|
return addToQueue("onuList", { mac }, async () => {
|
|
435
422
|
let retryCount = 0;
|
|
436
423
|
const maxRetries = 1;
|
|
@@ -451,12 +438,10 @@ function apply(ctx, config) {
|
|
|
451
438
|
const activeOnu = response.data.rows.find((row) => row.status === 1);
|
|
452
439
|
if (activeOnu) {
|
|
453
440
|
console.log("找到在线设备:", activeOnu);
|
|
454
|
-
setCache("onuList", { mac }, activeOnu);
|
|
455
441
|
return activeOnu;
|
|
456
442
|
}
|
|
457
443
|
const lastOnu = response.data.rows[response.data.rows.length - 1];
|
|
458
444
|
console.log("没有在线设备,返回最后一条记录:", lastOnu);
|
|
459
|
-
setCache("onuList", { mac }, lastOnu);
|
|
460
445
|
return lastOnu;
|
|
461
446
|
}
|
|
462
447
|
throw new Error(`查询失败:${response.message || "未找到设备信息"}`);
|
|
@@ -483,11 +468,6 @@ function apply(ctx, config) {
|
|
|
483
468
|
}
|
|
484
469
|
__name(queryOnuList, "queryOnuList");
|
|
485
470
|
async function queryOnuDetailInfo(onuId) {
|
|
486
|
-
const cachedData = getFromCache("onuDetail", { onuId });
|
|
487
|
-
if (cachedData) {
|
|
488
|
-
console.log("使用缓存的设备详细信息");
|
|
489
|
-
return cachedData;
|
|
490
|
-
}
|
|
491
471
|
return addToQueue("onuDetail", { onuId }, async () => {
|
|
492
472
|
let retryCount = 0;
|
|
493
473
|
const maxRetries = 1;
|
|
@@ -505,7 +485,6 @@ function apply(ctx, config) {
|
|
|
505
485
|
});
|
|
506
486
|
console.log("查询响应:", JSON.stringify(response, null, 2));
|
|
507
487
|
if (response.status === 200 && response.data) {
|
|
508
|
-
setCache("onuDetail", { onuId }, response.data);
|
|
509
488
|
return response.data;
|
|
510
489
|
}
|
|
511
490
|
throw new Error(`查询失败:${response.message || "未知错误"}`);
|
|
@@ -855,13 +834,15 @@ function apply(ctx, config) {
|
|
|
855
834
|
return !message.includes("\n") && message.length < 30;
|
|
856
835
|
}
|
|
857
836
|
__name(isShortPrompt, "isShortPrompt");
|
|
837
|
+
function getSeparator() {
|
|
838
|
+
return "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄";
|
|
839
|
+
}
|
|
840
|
+
__name(getSeparator, "getSeparator");
|
|
858
841
|
function formatOutputMessage(message) {
|
|
859
842
|
if (isShortPrompt(message)) {
|
|
860
843
|
return message;
|
|
861
844
|
}
|
|
862
|
-
|
|
863
|
-
message = message + "\n--------------------------------";
|
|
864
|
-
}
|
|
845
|
+
message = message.replace(/--------------------------------/g, getSeparator());
|
|
865
846
|
return "\n" + message;
|
|
866
847
|
}
|
|
867
848
|
__name(formatOutputMessage, "formatOutputMessage");
|
|
@@ -964,7 +945,7 @@ function apply(ctx, config) {
|
|
|
964
945
|
const { onuDetail, ccname, order, vlanInfo } = await queryTerminalInfo(cleanInput, true);
|
|
965
946
|
const messages = [
|
|
966
947
|
"🖥️ 终端基本信息",
|
|
967
|
-
|
|
948
|
+
getSeparator(),
|
|
968
949
|
`MAC地址: ${cleanInput}`,
|
|
969
950
|
`状态:${onuDetail.status === 1 ? "在线 ✅" : "不在线 ❌"}`,
|
|
970
951
|
`机房: ${onuDetail.roomName}`,
|
|
@@ -978,7 +959,7 @@ function apply(ctx, config) {
|
|
|
978
959
|
`CCName: ${ccname}`,
|
|
979
960
|
"",
|
|
980
961
|
"📃 工单信息",
|
|
981
|
-
|
|
962
|
+
getSeparator(),
|
|
982
963
|
order ? [
|
|
983
964
|
`工单编号: ${order.orderId}`,
|
|
984
965
|
`创建时间: ${order.createDate}`,
|
|
@@ -986,7 +967,7 @@ function apply(ctx, config) {
|
|
|
986
967
|
].join("\n") : "无工单信息",
|
|
987
968
|
"",
|
|
988
969
|
"⚙️ 业务配置信息",
|
|
989
|
-
|
|
970
|
+
getSeparator()
|
|
990
971
|
];
|
|
991
972
|
const vlanGroups = {};
|
|
992
973
|
vlanInfo.forEach((info) => {
|
|
@@ -1008,7 +989,7 @@ function apply(ctx, config) {
|
|
|
1008
989
|
` 工单VLAN: ${group.actualVlan}`
|
|
1009
990
|
);
|
|
1010
991
|
});
|
|
1011
|
-
messages.push(
|
|
992
|
+
messages.push(getSeparator());
|
|
1012
993
|
return messages.join("\n");
|
|
1013
994
|
} catch (error) {
|
|
1014
995
|
console.error("查询MAC地址过程出错:", error);
|
|
@@ -1044,10 +1025,10 @@ function apply(ctx, config) {
|
|
|
1044
1025
|
if (radiusUserInfo.code !== "000000" || !radiusUserInfo.data) {
|
|
1045
1026
|
const message = [
|
|
1046
1027
|
"🌐 账号查询结果",
|
|
1047
|
-
|
|
1028
|
+
getSeparator(),
|
|
1048
1029
|
`账号: ${input}`,
|
|
1049
1030
|
`RADIUS状态: ${radiusUserInfo.message || "账号授权验证失败"} ,请检查或者重新授权❌`,
|
|
1050
|
-
|
|
1031
|
+
getSeparator()
|
|
1051
1032
|
].join("\n");
|
|
1052
1033
|
return message;
|
|
1053
1034
|
}
|
|
@@ -1067,7 +1048,7 @@ function apply(ctx, config) {
|
|
|
1067
1048
|
}
|
|
1068
1049
|
const message = [
|
|
1069
1050
|
"🌐 账号查询结果",
|
|
1070
|
-
|
|
1051
|
+
getSeparator(),
|
|
1071
1052
|
`账号: ${accountInfo.accessUserName}`,
|
|
1072
1053
|
// `RADIUS用户密码: ${user.password}`,
|
|
1073
1054
|
`RADIUS状态: ${translateUserStatus(user.user_status)} ${user.user_status === "active" ? "✅" : user.user_status === "suspend" ? "⚠️" : "❌"}`,
|
|
@@ -1114,7 +1095,7 @@ function apply(ctx, config) {
|
|
|
1114
1095
|
message.push("");
|
|
1115
1096
|
if (orders && orders.length > 0) {
|
|
1116
1097
|
message.push("🛒 订购信息");
|
|
1117
|
-
message.push(
|
|
1098
|
+
message.push(getSeparator());
|
|
1118
1099
|
orders.forEach((order, index) => {
|
|
1119
1100
|
message.push(
|
|
1120
1101
|
`订购 #${index + 1}:`,
|
|
@@ -1128,23 +1109,23 @@ function apply(ctx, config) {
|
|
|
1128
1109
|
}
|
|
1129
1110
|
});
|
|
1130
1111
|
}
|
|
1131
|
-
message.push(
|
|
1112
|
+
message.push(getSeparator());
|
|
1132
1113
|
return message.join("\n");
|
|
1133
1114
|
} catch (accountError) {
|
|
1134
1115
|
console.error("智能查询中账号详细信息出错:", accountError);
|
|
1135
1116
|
const message = [
|
|
1136
1117
|
"🌐 账号查询结果(部分信息)",
|
|
1137
|
-
|
|
1118
|
+
getSeparator(),
|
|
1138
1119
|
`账号: ${input}`,
|
|
1139
1120
|
`RADIUS状态: ${translateUserStatus(user.user_status)} ${user.user_status === "active" ? "✅" : user.user_status === "suspend" ? "⚠️" : "❌"}`,
|
|
1140
1121
|
"",
|
|
1141
|
-
"⚠️
|
|
1122
|
+
"⚠️ 账号信息查询失败",
|
|
1142
1123
|
`错误信息: ${accountError.message || "未知错误"}`,
|
|
1143
1124
|
""
|
|
1144
1125
|
];
|
|
1145
1126
|
if (orders && orders.length > 0) {
|
|
1146
1127
|
message.push("🛒 订购信息");
|
|
1147
|
-
message.push(
|
|
1128
|
+
message.push(getSeparator());
|
|
1148
1129
|
orders.forEach((order, index) => {
|
|
1149
1130
|
message.push(
|
|
1150
1131
|
`订购 #${index + 1}:`,
|
|
@@ -1158,7 +1139,7 @@ function apply(ctx, config) {
|
|
|
1158
1139
|
}
|
|
1159
1140
|
});
|
|
1160
1141
|
}
|
|
1161
|
-
message.push(
|
|
1142
|
+
message.push(getSeparator());
|
|
1162
1143
|
return message.join("\n");
|
|
1163
1144
|
}
|
|
1164
1145
|
} catch (error) {
|
|
@@ -1183,10 +1164,10 @@ function apply(ctx, config) {
|
|
|
1183
1164
|
if (radiusUserInfo.code !== "000000" || !radiusUserInfo.data) {
|
|
1184
1165
|
const message = [
|
|
1185
1166
|
"🌐 账号查询结果",
|
|
1186
|
-
|
|
1167
|
+
getSeparator(),
|
|
1187
1168
|
`账号: ${account}`,
|
|
1188
1169
|
`RADIUS状态: ${radiusUserInfo.message || "账号授权验证失败"},请检查或者重新授权 ❌`,
|
|
1189
|
-
|
|
1170
|
+
getSeparator()
|
|
1190
1171
|
].join("\n");
|
|
1191
1172
|
return message;
|
|
1192
1173
|
}
|
|
@@ -1206,7 +1187,7 @@ function apply(ctx, config) {
|
|
|
1206
1187
|
}
|
|
1207
1188
|
const message = [
|
|
1208
1189
|
"🌐 账号查询结果",
|
|
1209
|
-
|
|
1190
|
+
getSeparator(),
|
|
1210
1191
|
`账号: ${accountInfo.accessUserName}`,
|
|
1211
1192
|
// `RADIUS用户密码: ${user.password}`,
|
|
1212
1193
|
`RADIUS状态: ${translateUserStatus(user.user_status)} ${user.user_status === "active" ? "✅" : user.user_status === "suspend" ? "⚠️" : "❌"}`,
|
|
@@ -1253,7 +1234,7 @@ function apply(ctx, config) {
|
|
|
1253
1234
|
message.push("");
|
|
1254
1235
|
if (orders && orders.length > 0) {
|
|
1255
1236
|
message.push("🛒 订购信息");
|
|
1256
|
-
message.push(
|
|
1237
|
+
message.push(getSeparator());
|
|
1257
1238
|
orders.forEach((order, index) => {
|
|
1258
1239
|
message.push(
|
|
1259
1240
|
`订购 #${index + 1}:`,
|
|
@@ -1267,23 +1248,23 @@ function apply(ctx, config) {
|
|
|
1267
1248
|
}
|
|
1268
1249
|
});
|
|
1269
1250
|
}
|
|
1270
|
-
message.push(
|
|
1251
|
+
message.push(getSeparator());
|
|
1271
1252
|
return message.join("\n");
|
|
1272
1253
|
} catch (accountError) {
|
|
1273
1254
|
console.error("查询账号详细信息出错:", accountError);
|
|
1274
1255
|
const message = [
|
|
1275
1256
|
"🌐 账号查询结果(部分信息)",
|
|
1276
|
-
|
|
1257
|
+
getSeparator(),
|
|
1277
1258
|
`账号: ${account}`,
|
|
1278
1259
|
`RADIUS状态: ${translateUserStatus(user.user_status)} ${user.user_status === "active" ? "✅" : user.user_status === "suspend" ? "⚠️" : "❌"}`,
|
|
1279
1260
|
"",
|
|
1280
|
-
"⚠️
|
|
1261
|
+
"⚠️ 账号信息查询失败",
|
|
1281
1262
|
`错误信息: ${accountError.message || "未知错误"}`,
|
|
1282
1263
|
""
|
|
1283
1264
|
];
|
|
1284
1265
|
if (orders && orders.length > 0) {
|
|
1285
1266
|
message.push("🛒 订购信息");
|
|
1286
|
-
message.push(
|
|
1267
|
+
message.push(getSeparator());
|
|
1287
1268
|
orders.forEach((order, index) => {
|
|
1288
1269
|
message.push(
|
|
1289
1270
|
`订购 #${index + 1}:`,
|
|
@@ -1297,7 +1278,7 @@ function apply(ctx, config) {
|
|
|
1297
1278
|
}
|
|
1298
1279
|
});
|
|
1299
1280
|
}
|
|
1300
|
-
message.push(
|
|
1281
|
+
message.push(getSeparator());
|
|
1301
1282
|
return message.join("\n");
|
|
1302
1283
|
}
|
|
1303
1284
|
} catch (error) {
|
|
@@ -1319,7 +1300,7 @@ function apply(ctx, config) {
|
|
|
1319
1300
|
}
|
|
1320
1301
|
const messages = records.map((record, index) => [
|
|
1321
1302
|
`📋 记录 #${index + 1}`,
|
|
1322
|
-
|
|
1303
|
+
getSeparator(),
|
|
1323
1304
|
`账号: ${record.accessUserName}`,
|
|
1324
1305
|
`记录类型: ${record.recordType}`,
|
|
1325
1306
|
`设备名称: ${record.nickName}`,
|
|
@@ -1330,7 +1311,7 @@ function apply(ctx, config) {
|
|
|
1330
1311
|
`原因: ${record.reason || "无"}`
|
|
1331
1312
|
].join("\n"));
|
|
1332
1313
|
let result = messages.join("\n\n");
|
|
1333
|
-
result +=
|
|
1314
|
+
result += getSeparator();
|
|
1334
1315
|
return result;
|
|
1335
1316
|
} catch (error) {
|
|
1336
1317
|
console.error("查询过程出错:", error);
|
|
@@ -1349,7 +1330,7 @@ function apply(ctx, config) {
|
|
|
1349
1330
|
const { onuDetail, vlanInfo } = await queryTerminalInfo(formattedMac, false);
|
|
1350
1331
|
const messages = [
|
|
1351
1332
|
"🖥️ 终端基本信息",
|
|
1352
|
-
|
|
1333
|
+
getSeparator(),
|
|
1353
1334
|
`MAC地址: ${formattedMac}`,
|
|
1354
1335
|
`状态:${onuDetail.status === 1 ? "在线 ✅" : "不在线 ❌"}`,
|
|
1355
1336
|
`设备名称: `,
|
|
@@ -1358,7 +1339,7 @@ function apply(ctx, config) {
|
|
|
1358
1339
|
`接收光功率: ${onuDetail.onuReceivePower === "设备不在线" ? "设备不在线" : onuDetail.onuReceivePower + "dBm"}${onuDetail.onuReceivePower !== "设备不在线" ? " " + evaluateOpticalPower(onuDetail.onuReceivePower) : ""}`,
|
|
1359
1340
|
"",
|
|
1360
1341
|
"⚙️ 业务配置信息",
|
|
1361
|
-
|
|
1342
|
+
getSeparator()
|
|
1362
1343
|
];
|
|
1363
1344
|
const vlanGroups = {};
|
|
1364
1345
|
vlanInfo.forEach((info) => {
|
|
@@ -1380,7 +1361,7 @@ function apply(ctx, config) {
|
|
|
1380
1361
|
` 工单VLAN: ${group.actualVlan}`
|
|
1381
1362
|
);
|
|
1382
1363
|
});
|
|
1383
|
-
messages.push(
|
|
1364
|
+
messages.push(getSeparator());
|
|
1384
1365
|
return messages.join("\n");
|
|
1385
1366
|
} catch (error) {
|
|
1386
1367
|
console.error("查询过程出错:", error);
|
|
@@ -1399,7 +1380,7 @@ function apply(ctx, config) {
|
|
|
1399
1380
|
const { onuDetail, ccname, order, vlanInfo } = await queryTerminalInfo(formattedMac, true);
|
|
1400
1381
|
const messages = [
|
|
1401
1382
|
"🖥️ 终端基本信息",
|
|
1402
|
-
|
|
1383
|
+
getSeparator(),
|
|
1403
1384
|
`MAC地址: ${formattedMac}`,
|
|
1404
1385
|
`状态:${onuDetail.status === 1 ? "在线 ✅" : "不在线 ❌"}`,
|
|
1405
1386
|
`机房: ${onuDetail.roomName}`,
|
|
@@ -1413,7 +1394,7 @@ function apply(ctx, config) {
|
|
|
1413
1394
|
`CCName: ${ccname}`,
|
|
1414
1395
|
"",
|
|
1415
1396
|
"📃 工单信息",
|
|
1416
|
-
|
|
1397
|
+
getSeparator(),
|
|
1417
1398
|
order ? [
|
|
1418
1399
|
`工单编号: ${order.orderId}`,
|
|
1419
1400
|
`创建时间: ${order.createDate}`,
|
|
@@ -1421,7 +1402,7 @@ function apply(ctx, config) {
|
|
|
1421
1402
|
].join("\n") : "无工单信息",
|
|
1422
1403
|
"",
|
|
1423
1404
|
"⚙️ 业务配置信息",
|
|
1424
|
-
|
|
1405
|
+
getSeparator()
|
|
1425
1406
|
];
|
|
1426
1407
|
const vlanGroups = {};
|
|
1427
1408
|
vlanInfo.forEach((info) => {
|
|
@@ -1443,7 +1424,7 @@ function apply(ctx, config) {
|
|
|
1443
1424
|
` 工单VLAN: ${group.actualVlan}`
|
|
1444
1425
|
);
|
|
1445
1426
|
});
|
|
1446
|
-
messages.push(
|
|
1427
|
+
messages.push(getSeparator());
|
|
1447
1428
|
return messages.join("\n");
|
|
1448
1429
|
} catch (error) {
|
|
1449
1430
|
console.error("查询过程出错:", error);
|
|
@@ -1484,7 +1465,7 @@ function apply(ctx, config) {
|
|
|
1484
1465
|
const batchLogs = filteredLogs.slice(startIdx, endIdx);
|
|
1485
1466
|
const messages = [
|
|
1486
1467
|
`📝 上线分析日志 (第 ${i + 1}/${totalBatches} 批)`,
|
|
1487
|
-
|
|
1468
|
+
getSeparator()
|
|
1488
1469
|
];
|
|
1489
1470
|
batchLogs.forEach((log, index) => {
|
|
1490
1471
|
messages.push(
|
|
@@ -1493,11 +1474,11 @@ function apply(ctx, config) {
|
|
|
1493
1474
|
`描述: ${log.description || "无描述"}`,
|
|
1494
1475
|
`创建时间: ${log.createTime || "未知"}`,
|
|
1495
1476
|
`更新时间: ${log.updateTime || "未知"}`,
|
|
1496
|
-
|
|
1477
|
+
getSeparator()
|
|
1497
1478
|
);
|
|
1498
1479
|
});
|
|
1499
1480
|
if (!messages[messages.length - 1].includes("----")) {
|
|
1500
|
-
messages.push(
|
|
1481
|
+
messages.push(getSeparator());
|
|
1501
1482
|
}
|
|
1502
1483
|
await session?.send(formatOutputMessage(messages.join("\n")));
|
|
1503
1484
|
if (i < totalBatches - 1) {
|
|
@@ -1522,7 +1503,7 @@ function apply(ctx, config) {
|
|
|
1522
1503
|
const { user, orders } = radiusUserInfo.data;
|
|
1523
1504
|
const messages = [
|
|
1524
1505
|
"🔐 RADIUS用户信息",
|
|
1525
|
-
|
|
1506
|
+
getSeparator(),
|
|
1526
1507
|
`账号: ${user.login_name}`,
|
|
1527
1508
|
// `密码: ${user.password}`,
|
|
1528
1509
|
`状态: ${translateUserStatus(user.user_status)} ${user.user_status === "active" ? "✅" : user.user_status === "suspend" ? "⚠️" : "❌"}`,
|
|
@@ -1532,7 +1513,7 @@ function apply(ctx, config) {
|
|
|
1532
1513
|
`用户VLAN: ${user.user_vlan}`,
|
|
1533
1514
|
"",
|
|
1534
1515
|
"🛒 订购信息",
|
|
1535
|
-
|
|
1516
|
+
getSeparator()
|
|
1536
1517
|
];
|
|
1537
1518
|
if (orders && orders.length > 0) {
|
|
1538
1519
|
orders.forEach((order, index) => {
|
|
@@ -1550,7 +1531,7 @@ function apply(ctx, config) {
|
|
|
1550
1531
|
} else {
|
|
1551
1532
|
messages.push("无订购信息");
|
|
1552
1533
|
}
|
|
1553
|
-
messages.push(
|
|
1534
|
+
messages.push(getSeparator());
|
|
1554
1535
|
return messages.join("\n");
|
|
1555
1536
|
} catch (error) {
|
|
1556
1537
|
console.error("查询过程出错:", error);
|
|
@@ -1581,7 +1562,7 @@ function apply(ctx, config) {
|
|
|
1581
1562
|
}, "buildBar");
|
|
1582
1563
|
return [
|
|
1583
1564
|
"📈 系统状态监控",
|
|
1584
|
-
|
|
1565
|
+
getSeparator(),
|
|
1585
1566
|
`缓存命中率: ${hitRate}% ${buildBar(hitRate)}`,
|
|
1586
1567
|
`缓存项数量: ${cacheStats.totalItems}项`,
|
|
1587
1568
|
`缓存占用空间: 约 ${cacheStats.totalSize} KB`,
|
|
@@ -1589,7 +1570,7 @@ function apply(ctx, config) {
|
|
|
1589
1570
|
`等待请求: ${waitingRequests}`,
|
|
1590
1571
|
`消息队列: ${messageQueue.length}/${MAX_QUEUE_LENGTH} ${buildBar(messageQueueUtilization)}`,
|
|
1591
1572
|
`处理状态: ${isProcessingMessage ? "正在处理" : "空闲"}`,
|
|
1592
|
-
|
|
1573
|
+
getSeparator()
|
|
1593
1574
|
].join("\n");
|
|
1594
1575
|
}
|
|
1595
1576
|
__name(getSystemStatus, "getSystemStatus");
|
|
@@ -1599,7 +1580,7 @@ function apply(ctx, config) {
|
|
|
1599
1580
|
ctx.command("使用说明", "显示插件的使用方法和命令说明").alias("/使用说明").action(async ({ session }) => {
|
|
1600
1581
|
const helpText = [
|
|
1601
1582
|
"📋 JSCN小帮手使用说明",
|
|
1602
|
-
|
|
1583
|
+
getSeparator(),
|
|
1603
1584
|
"命令格式:",
|
|
1604
1585
|
" @JSCN小助手+命令+空格+带查询参数",
|
|
1605
1586
|
"示例:",
|
|
@@ -1612,7 +1593,7 @@ function apply(ctx, config) {
|
|
|
1612
1593
|
" 3. 命令与参数之间必须需要加空格!",
|
|
1613
1594
|
"",
|
|
1614
1595
|
"🔍 核心功能与命令(@JSCN小帮手之后再输入命令)",
|
|
1615
|
-
|
|
1596
|
+
getSeparator(),
|
|
1616
1597
|
"1. 账号查询",
|
|
1617
1598
|
" 命令:账号查询 [账号]",
|
|
1618
1599
|
" 示例:账号查询 GDC8510019239048(账号不区分大小写)",
|
|
@@ -1639,7 +1620,7 @@ function apply(ctx, config) {
|
|
|
1639
1620
|
" 示例:",
|
|
1640
1621
|
" 输入 GDC8510019239048 → 触发账号查询",
|
|
1641
1622
|
" 输入 00:11:22:33:44:55 → 触发终端查询",
|
|
1642
|
-
|
|
1623
|
+
getSeparator()
|
|
1643
1624
|
].join("\n");
|
|
1644
1625
|
return formatOutputMessage(helpText);
|
|
1645
1626
|
});
|