koishi-plugin-jscn-aaaquery 1.0.13 → 1.0.14
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 +221 -147
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -51,7 +51,7 @@ function evaluateOpticalPower(power) {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
__name(evaluateOpticalPower, "evaluateOpticalPower");
|
|
54
|
-
var CACHE_EXPIRE_TIME =
|
|
54
|
+
var CACHE_EXPIRE_TIME = 2 * 60 * 1e3;
|
|
55
55
|
var CACHE_CLEAN_INTERVAL = 60 * 1e3;
|
|
56
56
|
var CACHE_STATS_RESET_INTERVAL = 24 * 60 * 60 * 1e3;
|
|
57
57
|
var QUEUE_EXPIRE_TIME = 2 * 60 * 1e3;
|
|
@@ -60,6 +60,12 @@ var MAX_CONCURRENT_REQUESTS = 5;
|
|
|
60
60
|
var MESSAGE_TIMEOUT = 2 * 60 * 1e3;
|
|
61
61
|
var MESSAGE_CLEAN_INTERVAL = 60 * 1e3;
|
|
62
62
|
function apply(ctx, config) {
|
|
63
|
+
const CACHE_EXPIRATION = 2 * 60 * 1e3;
|
|
64
|
+
const CACHE_CLEANUP_INTERVAL = 10 * 60 * 1e3;
|
|
65
|
+
const CACHE_STATS_RESET_INTERVAL2 = 24 * 60 * 60 * 1e3;
|
|
66
|
+
const REQUEST_QUEUE_EXPIRATION = 5 * 60 * 1e3;
|
|
67
|
+
const REQUEST_QUEUE_CLEANUP_INTERVAL = 10 * 60 * 1e3;
|
|
68
|
+
const TOKEN_REFRESH_THRESHOLD = 5 * 60 * 1e3;
|
|
63
69
|
let currentToken = null;
|
|
64
70
|
let tokenExpireTime = 0;
|
|
65
71
|
const requestQueue = {};
|
|
@@ -140,7 +146,7 @@ function apply(ctx, config) {
|
|
|
140
146
|
cacheStats.misses = 0;
|
|
141
147
|
cacheStats.cleanups = 0;
|
|
142
148
|
cacheStats.itemsRemoved = 0;
|
|
143
|
-
},
|
|
149
|
+
}, CACHE_STATS_RESET_INTERVAL2);
|
|
144
150
|
function getCacheStats() {
|
|
145
151
|
updateCacheStats();
|
|
146
152
|
const hitRate = cacheStats.hits + cacheStats.misses > 0 ? Math.round(cacheStats.hits / (cacheStats.hits + cacheStats.misses) * 100) : 0;
|
|
@@ -245,12 +251,32 @@ function apply(ctx, config) {
|
|
|
245
251
|
__name(isAccountResponseComplete, "isAccountResponseComplete");
|
|
246
252
|
async function getToken() {
|
|
247
253
|
const now = Date.now();
|
|
254
|
+
if (currentToken && now < tokenExpireTime - TOKEN_REFRESH_THRESHOLD) {
|
|
255
|
+
console.log("使用缓存的token,过期时间:", new Date(tokenExpireTime).toLocaleString());
|
|
256
|
+
return currentToken;
|
|
257
|
+
}
|
|
248
258
|
if (currentToken && now < tokenExpireTime) {
|
|
249
|
-
console.log("
|
|
259
|
+
console.log("token即将过期,后台刷新token");
|
|
260
|
+
refreshTokenInBackground();
|
|
250
261
|
return currentToken;
|
|
251
262
|
}
|
|
263
|
+
return refreshToken();
|
|
264
|
+
}
|
|
265
|
+
__name(getToken, "getToken");
|
|
266
|
+
async function refreshTokenInBackground() {
|
|
252
267
|
try {
|
|
253
|
-
console.log("
|
|
268
|
+
console.log("开始在后台刷新token...");
|
|
269
|
+
refreshToken().catch((error) => {
|
|
270
|
+
console.error("后台刷新token失败:", error);
|
|
271
|
+
});
|
|
272
|
+
} catch (error) {
|
|
273
|
+
console.error("启动后台刷新token失败:", error);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
__name(refreshTokenInBackground, "refreshTokenInBackground");
|
|
277
|
+
async function refreshToken() {
|
|
278
|
+
try {
|
|
279
|
+
console.log("开始登录请求刷新token...");
|
|
254
280
|
await waitForRequestSlot();
|
|
255
281
|
const response = await ctx.http.post(
|
|
256
282
|
`${config.baseUrl}/admin/login`,
|
|
@@ -280,7 +306,7 @@ function apply(ctx, config) {
|
|
|
280
306
|
releaseRequestSlot();
|
|
281
307
|
}
|
|
282
308
|
}
|
|
283
|
-
__name(
|
|
309
|
+
__name(refreshToken, "refreshToken");
|
|
284
310
|
async function queryAccount(account) {
|
|
285
311
|
const formattedAccount = formatAccount(account);
|
|
286
312
|
const cachedData = getFromCache("account", { account: formattedAccount });
|
|
@@ -289,10 +315,83 @@ function apply(ctx, config) {
|
|
|
289
315
|
return cachedData;
|
|
290
316
|
}
|
|
291
317
|
return addToQueue("account", { account: formattedAccount }, async () => {
|
|
318
|
+
let retryCount = 0;
|
|
319
|
+
const maxRetries = 1;
|
|
320
|
+
while (retryCount <= maxRetries) {
|
|
321
|
+
try {
|
|
322
|
+
console.log("开始查询账号信息...");
|
|
323
|
+
const token = await getToken();
|
|
324
|
+
const response = await ctx.http.get(`${config.baseUrl}/fttx/aaa/aaaCertification`, {
|
|
325
|
+
params: { accessUserName: formattedAccount },
|
|
326
|
+
headers: {
|
|
327
|
+
"Authorization": token,
|
|
328
|
+
"Accept": "application/json",
|
|
329
|
+
"Content-Type": "application/json"
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
console.log("查询响应:", JSON.stringify(response, null, 2));
|
|
333
|
+
if (response.status === 200 && response.data) {
|
|
334
|
+
if (response.data.isPass === "上线失败") {
|
|
335
|
+
console.log("账号上线失败,将使用失败信息");
|
|
336
|
+
if (!response.data.startTimeSum) response.data.startTimeSum = 0;
|
|
337
|
+
if (!response.data.maxUpSpeed) response.data.maxUpSpeed = 0;
|
|
338
|
+
if (!response.data.maxDownSpeed) response.data.maxDownSpeed = 0;
|
|
339
|
+
if (!response.data.startTime) response.data.startTime = response.data.onlineFailTime || "未知";
|
|
340
|
+
if (!response.data.nickName) response.data.nickName = response.data.nickName || "未知";
|
|
341
|
+
setCache("account", { account: formattedAccount }, response.data);
|
|
342
|
+
return response.data;
|
|
343
|
+
}
|
|
344
|
+
if (response.data.onlineStatus === "离线" || response.data.onlineStatus === "不在线" || response.data.isPass === "原因未知") {
|
|
345
|
+
console.log("账号离线或状态异常,将使用有限信息");
|
|
346
|
+
if (!response.data.startTimeSum) response.data.startTimeSum = 0;
|
|
347
|
+
if (!response.data.maxUpSpeed) response.data.maxUpSpeed = 0;
|
|
348
|
+
if (!response.data.maxDownSpeed) response.data.maxDownSpeed = 0;
|
|
349
|
+
if (!response.data.startTime) response.data.startTime = response.data.userLoginOutTime || "未知";
|
|
350
|
+
if (!response.data.nickName) response.data.nickName = "未知";
|
|
351
|
+
if (!response.data.mac) response.data.mac = "未知";
|
|
352
|
+
if (!response.data.userIp) response.data.userIp = "未知";
|
|
353
|
+
if (!response.data.accessDomain) response.data.accessDomain = "未知";
|
|
354
|
+
setCache("account", { account: formattedAccount }, response.data);
|
|
355
|
+
return response.data;
|
|
356
|
+
}
|
|
357
|
+
if (!isAccountResponseComplete(response.data)) {
|
|
358
|
+
throw new Error("账号信息有误,请检查账号是否正确");
|
|
359
|
+
}
|
|
360
|
+
setCache("account", { account: formattedAccount }, response.data);
|
|
361
|
+
return response.data;
|
|
362
|
+
}
|
|
363
|
+
throw new Error(`查询失败:${response.message || "未知错误"}`);
|
|
364
|
+
} catch (error) {
|
|
365
|
+
console.error("查询错误详情:", error);
|
|
366
|
+
if (error.response) {
|
|
367
|
+
console.error("错误响应:", error.response.data);
|
|
368
|
+
if (error.response.status === 401) {
|
|
369
|
+
console.log("Token已过期或无效,正在重置token并重试...");
|
|
370
|
+
currentToken = null;
|
|
371
|
+
tokenExpireTime = 0;
|
|
372
|
+
if (retryCount < maxRetries) {
|
|
373
|
+
retryCount++;
|
|
374
|
+
console.log(`重试第${retryCount}次`);
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
throw error;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
throw new Error("请求失败,重试次数已用完");
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
__name(queryAccount, "queryAccount");
|
|
386
|
+
async function queryAccountDetail(account) {
|
|
387
|
+
const formattedAccount = formatAccount(account);
|
|
388
|
+
let retryCount = 0;
|
|
389
|
+
const maxRetries = 1;
|
|
390
|
+
while (retryCount <= maxRetries) {
|
|
292
391
|
try {
|
|
293
|
-
console.log("
|
|
392
|
+
console.log("开始查询账号详情记录...");
|
|
294
393
|
const token = await getToken();
|
|
295
|
-
const response = await ctx.http.get(`${config.baseUrl}/fttx/aaa/
|
|
394
|
+
const response = await ctx.http.get(`${config.baseUrl}/fttx/aaa/getMoreRecord`, {
|
|
296
395
|
params: { accessUserName: formattedAccount },
|
|
297
396
|
headers: {
|
|
298
397
|
"Authorization": token,
|
|
@@ -302,33 +401,6 @@ function apply(ctx, config) {
|
|
|
302
401
|
});
|
|
303
402
|
console.log("查询响应:", JSON.stringify(response, null, 2));
|
|
304
403
|
if (response.status === 200 && response.data) {
|
|
305
|
-
if (response.data.isPass === "上线失败") {
|
|
306
|
-
console.log("账号上线失败,将使用失败信息");
|
|
307
|
-
if (!response.data.startTimeSum) response.data.startTimeSum = 0;
|
|
308
|
-
if (!response.data.maxUpSpeed) response.data.maxUpSpeed = 0;
|
|
309
|
-
if (!response.data.maxDownSpeed) response.data.maxDownSpeed = 0;
|
|
310
|
-
if (!response.data.startTime) response.data.startTime = response.data.onlineFailTime || "未知";
|
|
311
|
-
if (!response.data.nickName) response.data.nickName = response.data.nickName || "未知";
|
|
312
|
-
setCache("account", { account: formattedAccount }, response.data);
|
|
313
|
-
return response.data;
|
|
314
|
-
}
|
|
315
|
-
if (response.data.onlineStatus === "离线" || response.data.onlineStatus === "不在线" || response.data.isPass === "原因未知") {
|
|
316
|
-
console.log("账号离线或状态异常,将使用有限信息");
|
|
317
|
-
if (!response.data.startTimeSum) response.data.startTimeSum = 0;
|
|
318
|
-
if (!response.data.maxUpSpeed) response.data.maxUpSpeed = 0;
|
|
319
|
-
if (!response.data.maxDownSpeed) response.data.maxDownSpeed = 0;
|
|
320
|
-
if (!response.data.startTime) response.data.startTime = response.data.userLoginOutTime || "未知";
|
|
321
|
-
if (!response.data.nickName) response.data.nickName = "未知";
|
|
322
|
-
if (!response.data.mac) response.data.mac = "未知";
|
|
323
|
-
if (!response.data.userIp) response.data.userIp = "未知";
|
|
324
|
-
if (!response.data.accessDomain) response.data.accessDomain = "未知";
|
|
325
|
-
setCache("account", { account: formattedAccount }, response.data);
|
|
326
|
-
return response.data;
|
|
327
|
-
}
|
|
328
|
-
if (!isAccountResponseComplete(response.data)) {
|
|
329
|
-
throw new Error("账号信息有误,请检查账号是否正确");
|
|
330
|
-
}
|
|
331
|
-
setCache("account", { account: formattedAccount }, response.data);
|
|
332
404
|
return response.data;
|
|
333
405
|
}
|
|
334
406
|
throw new Error(`查询失败:${response.message || "未知错误"}`);
|
|
@@ -336,37 +408,21 @@ function apply(ctx, config) {
|
|
|
336
408
|
console.error("查询错误详情:", error);
|
|
337
409
|
if (error.response) {
|
|
338
410
|
console.error("错误响应:", error.response.data);
|
|
411
|
+
if (error.response.status === 401) {
|
|
412
|
+
console.log("Token已过期或无效,正在重置token并重试...");
|
|
413
|
+
currentToken = null;
|
|
414
|
+
tokenExpireTime = 0;
|
|
415
|
+
if (retryCount < maxRetries) {
|
|
416
|
+
retryCount++;
|
|
417
|
+
console.log(`重试第${retryCount}次`);
|
|
418
|
+
continue;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
339
421
|
}
|
|
340
422
|
throw error;
|
|
341
423
|
}
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
__name(queryAccount, "queryAccount");
|
|
345
|
-
async function queryAccountDetail(account) {
|
|
346
|
-
const formattedAccount = formatAccount(account);
|
|
347
|
-
try {
|
|
348
|
-
console.log("开始查询账号详情记录...");
|
|
349
|
-
const token = await getToken();
|
|
350
|
-
const response = await ctx.http.get(`${config.baseUrl}/fttx/aaa/getMoreRecord`, {
|
|
351
|
-
params: { accessUserName: formattedAccount },
|
|
352
|
-
headers: {
|
|
353
|
-
"Authorization": token,
|
|
354
|
-
"Accept": "application/json",
|
|
355
|
-
"Content-Type": "application/json"
|
|
356
|
-
}
|
|
357
|
-
});
|
|
358
|
-
console.log("查询响应:", JSON.stringify(response, null, 2));
|
|
359
|
-
if (response.status === 200 && response.data) {
|
|
360
|
-
return response.data;
|
|
361
|
-
}
|
|
362
|
-
throw new Error(`查询失败:${response.message || "未知错误"}`);
|
|
363
|
-
} catch (error) {
|
|
364
|
-
console.error("查询错误详情:", error);
|
|
365
|
-
if (error.response) {
|
|
366
|
-
console.error("错误响应:", error.response.data);
|
|
367
|
-
}
|
|
368
|
-
throw error;
|
|
369
424
|
}
|
|
425
|
+
throw new Error("请求失败,重试次数已用完");
|
|
370
426
|
}
|
|
371
427
|
__name(queryAccountDetail, "queryAccountDetail");
|
|
372
428
|
async function queryOnuList(mac) {
|
|
@@ -376,38 +432,53 @@ function apply(ctx, config) {
|
|
|
376
432
|
return cachedData;
|
|
377
433
|
}
|
|
378
434
|
return addToQueue("onuList", { mac }, async () => {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
435
|
+
let retryCount = 0;
|
|
436
|
+
const maxRetries = 1;
|
|
437
|
+
while (retryCount <= maxRetries) {
|
|
438
|
+
try {
|
|
439
|
+
console.log("开始查询MAC设备信息...");
|
|
440
|
+
const token = await getToken();
|
|
441
|
+
const response = await ctx.http.get(`${config.baseUrl}/fttx/onu/searchOnuList`, {
|
|
442
|
+
params: { mac, limit: 10, page: 1 },
|
|
443
|
+
headers: {
|
|
444
|
+
"Authorization": token,
|
|
445
|
+
"Accept": "application/json",
|
|
446
|
+
"Content-Type": "application/json"
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
console.log("查询响应:", JSON.stringify(response, null, 2));
|
|
450
|
+
if (response.status === 200 && response.data && response.data.rows && response.data.rows.length > 0) {
|
|
451
|
+
const activeOnu = response.data.rows.find((row) => row.status === 1);
|
|
452
|
+
if (activeOnu) {
|
|
453
|
+
console.log("找到在线设备:", activeOnu);
|
|
454
|
+
setCache("onuList", { mac }, activeOnu);
|
|
455
|
+
return activeOnu;
|
|
456
|
+
}
|
|
457
|
+
const lastOnu = response.data.rows[response.data.rows.length - 1];
|
|
458
|
+
console.log("没有在线设备,返回最后一条记录:", lastOnu);
|
|
459
|
+
setCache("onuList", { mac }, lastOnu);
|
|
460
|
+
return lastOnu;
|
|
388
461
|
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
462
|
+
throw new Error(`查询失败:${response.message || "未找到设备信息"}`);
|
|
463
|
+
} catch (error) {
|
|
464
|
+
console.error("查询错误详情:", error);
|
|
465
|
+
if (error.response) {
|
|
466
|
+
console.error("错误响应:", error.response.data);
|
|
467
|
+
if (error.response.status === 401) {
|
|
468
|
+
console.log("Token已过期或无效,正在重置token并重试...");
|
|
469
|
+
currentToken = null;
|
|
470
|
+
tokenExpireTime = 0;
|
|
471
|
+
if (retryCount < maxRetries) {
|
|
472
|
+
retryCount++;
|
|
473
|
+
console.log(`重试第${retryCount}次`);
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
397
477
|
}
|
|
398
|
-
|
|
399
|
-
console.log("没有在线设备,返回最后一条记录:", lastOnu);
|
|
400
|
-
setCache("onuList", { mac }, lastOnu);
|
|
401
|
-
return lastOnu;
|
|
478
|
+
throw error;
|
|
402
479
|
}
|
|
403
|
-
throw new Error(`查询失败:${response.message || "未找到设备信息"}`);
|
|
404
|
-
} catch (error) {
|
|
405
|
-
console.error("查询错误详情:", error);
|
|
406
|
-
if (error.response) {
|
|
407
|
-
console.error("错误响应:", error.response.data);
|
|
408
|
-
}
|
|
409
|
-
throw error;
|
|
410
480
|
}
|
|
481
|
+
throw new Error("请求失败,重试次数已用完");
|
|
411
482
|
});
|
|
412
483
|
}
|
|
413
484
|
__name(queryOnuList, "queryOnuList");
|
|
@@ -418,68 +489,45 @@ function apply(ctx, config) {
|
|
|
418
489
|
return cachedData;
|
|
419
490
|
}
|
|
420
491
|
return addToQueue("onuDetail", { onuId }, async () => {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
492
|
+
let retryCount = 0;
|
|
493
|
+
const maxRetries = 1;
|
|
494
|
+
while (retryCount <= maxRetries) {
|
|
495
|
+
try {
|
|
496
|
+
console.log("开始查询MAC详细信息...");
|
|
497
|
+
const token = await getToken();
|
|
498
|
+
const response = await ctx.http.get(`${config.baseUrl}/fttx/onu/onuDetailInfo`, {
|
|
499
|
+
params: { onuId },
|
|
500
|
+
headers: {
|
|
501
|
+
"Authorization": token,
|
|
502
|
+
"Accept": "application/json",
|
|
503
|
+
"Content-Type": "application/json"
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
console.log("查询响应:", JSON.stringify(response, null, 2));
|
|
507
|
+
if (response.status === 200 && response.data) {
|
|
508
|
+
setCache("onuDetail", { onuId }, response.data);
|
|
509
|
+
return response.data;
|
|
430
510
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
headers: {
|
|
445
|
-
"Authorization": token,
|
|
446
|
-
"Accept": "application/json",
|
|
447
|
-
"Content-Type": "application/json"
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
);
|
|
451
|
-
if (powerResponse.status === 200 && powerResponse.data) {
|
|
452
|
-
console.log("光功率刷新结果:", powerResponse.data);
|
|
453
|
-
if (powerResponse.data.status !== void 0) {
|
|
454
|
-
response.data.status = powerResponse.data.status;
|
|
455
|
-
}
|
|
456
|
-
if (response.data.status !== 1 && (powerResponse.data.onuReceivePower === void 0 || powerResponse.data.onuSendPower === void 0)) {
|
|
457
|
-
response.data.onuReceivePower = "设备不在线";
|
|
458
|
-
response.data.onuSendPower = "设备不在线";
|
|
459
|
-
} else {
|
|
460
|
-
response.data.onuReceivePower = powerResponse.data.onuReceivePower;
|
|
461
|
-
response.data.onuSendPower = powerResponse.data.onuSendPower;
|
|
511
|
+
throw new Error(`查询失败:${response.message || "未知错误"}`);
|
|
512
|
+
} catch (error) {
|
|
513
|
+
console.error("查询错误详情:", error);
|
|
514
|
+
if (error.response) {
|
|
515
|
+
console.error("错误响应:", error.response.data);
|
|
516
|
+
if (error.response.status === 401) {
|
|
517
|
+
console.log("Token已过期或无效,正在重置token并重试...");
|
|
518
|
+
currentToken = null;
|
|
519
|
+
tokenExpireTime = 0;
|
|
520
|
+
if (retryCount < maxRetries) {
|
|
521
|
+
retryCount++;
|
|
522
|
+
console.log(`重试第${retryCount}次`);
|
|
523
|
+
continue;
|
|
462
524
|
}
|
|
463
|
-
response.data.statusHealth = powerResponse.data.statusHealth;
|
|
464
|
-
}
|
|
465
|
-
} catch (error) {
|
|
466
|
-
console.error("刷新光功率过程中出错:", error);
|
|
467
|
-
if (response.data.status !== 1 && (response.data.onuReceivePower === void 0 || response.data.onuReceivePower === null || response.data.onuSendPower === void 0 || response.data.onuSendPower === null)) {
|
|
468
|
-
response.data.onuReceivePower = "设备不在线";
|
|
469
|
-
response.data.onuSendPower = "设备不在线";
|
|
470
525
|
}
|
|
471
526
|
}
|
|
472
|
-
|
|
473
|
-
return response.data;
|
|
527
|
+
throw error;
|
|
474
528
|
}
|
|
475
|
-
throw new Error(`查询失败:${response.message || "未知错误"}`);
|
|
476
|
-
} catch (error) {
|
|
477
|
-
console.error("查询错误详情:", error);
|
|
478
|
-
if (error.response) {
|
|
479
|
-
console.error("错误响应:", error.response.data);
|
|
480
|
-
}
|
|
481
|
-
throw error;
|
|
482
529
|
}
|
|
530
|
+
throw new Error("请求失败,重试次数已用完");
|
|
483
531
|
});
|
|
484
532
|
}
|
|
485
533
|
__name(queryOnuDetailInfo, "queryOnuDetailInfo");
|
|
@@ -1035,11 +1083,24 @@ function apply(ctx, config) {
|
|
|
1035
1083
|
`回复消息: ${accountInfo.failReplyMessage || "未知"}`,
|
|
1036
1084
|
`原因分析: ${accountInfo.reasonAnaly || "未知"}`
|
|
1037
1085
|
);
|
|
1038
|
-
} else if (accountInfo.onlineStatus === "离线"
|
|
1086
|
+
} else if (accountInfo.onlineStatus === "离线" && accountInfo.isPass === "原因未知") {
|
|
1039
1087
|
message.push(
|
|
1040
1088
|
`未检索到账号信息⚠️`,
|
|
1041
1089
|
`请检查ONU配置和账号是否正确或尝试重新拨号!`
|
|
1042
1090
|
);
|
|
1091
|
+
} else if (accountInfo.onlineStatus === "离线" || accountInfo.onlineStatus === "不在线") {
|
|
1092
|
+
message.push(
|
|
1093
|
+
`MAC地址: ${accountInfo.mac || "未知"}`
|
|
1094
|
+
);
|
|
1095
|
+
if (accountInfo.startTime) {
|
|
1096
|
+
message.push(`最后在线: ${accountInfo.startTime || "未知"}`);
|
|
1097
|
+
}
|
|
1098
|
+
if (accountInfo.offlineReason) {
|
|
1099
|
+
message.push(`离线原因: ${accountInfo.offlineReason || "未知"}`);
|
|
1100
|
+
}
|
|
1101
|
+
if (accountInfo.reasonAnaly) {
|
|
1102
|
+
message.push(`原因分析: ${accountInfo.reasonAnaly || "未知"}`);
|
|
1103
|
+
}
|
|
1043
1104
|
} else {
|
|
1044
1105
|
message.push(
|
|
1045
1106
|
`IP地址: ${accountInfo.userIp}`,
|
|
@@ -1161,11 +1222,24 @@ function apply(ctx, config) {
|
|
|
1161
1222
|
`回复消息: ${accountInfo.failReplyMessage || "未知"}`,
|
|
1162
1223
|
`原因分析: ${accountInfo.reasonAnaly || "未知"}`
|
|
1163
1224
|
);
|
|
1164
|
-
} else if (accountInfo.onlineStatus === "离线"
|
|
1225
|
+
} else if (accountInfo.onlineStatus === "离线" && accountInfo.isPass === "原因未知") {
|
|
1165
1226
|
message.push(
|
|
1166
1227
|
`未检索到账号信息⚠️`,
|
|
1167
1228
|
`请检查ONU配置和账号是否正确或尝试重新拨号!`
|
|
1168
1229
|
);
|
|
1230
|
+
} else if (accountInfo.onlineStatus === "离线" || accountInfo.onlineStatus === "不在线") {
|
|
1231
|
+
message.push(
|
|
1232
|
+
`MAC地址: ${accountInfo.mac || "未知"}`
|
|
1233
|
+
);
|
|
1234
|
+
if (accountInfo.startTime) {
|
|
1235
|
+
message.push(`最后在线: ${accountInfo.startTime || "未知"}`);
|
|
1236
|
+
}
|
|
1237
|
+
if (accountInfo.offlineReason) {
|
|
1238
|
+
message.push(`离线原因: ${accountInfo.offlineReason || "未知"}`);
|
|
1239
|
+
}
|
|
1240
|
+
if (accountInfo.reasonAnaly) {
|
|
1241
|
+
message.push(`原因分析: ${accountInfo.reasonAnaly || "未知"}`);
|
|
1242
|
+
}
|
|
1169
1243
|
} else {
|
|
1170
1244
|
message.push(
|
|
1171
1245
|
`IP地址: ${accountInfo.userIp}`,
|