优化监控任务多账号配置
This commit is contained in:
@@ -79,16 +79,24 @@ export function notifyCloudtentaclesAuthExpired({
|
||||
errorCode = '',
|
||||
message = '',
|
||||
cooldownSeconds = 600,
|
||||
sourceKey = '',
|
||||
accountLabel = '',
|
||||
}: JsonObject = {}) {
|
||||
const normalizedSourceKey = String(sourceKey || '').trim()
|
||||
const normalizedAccountLabel = String(accountLabel || '').trim()
|
||||
|
||||
return notifyInternalSafely({
|
||||
title: 'cloudtentacles 登录已过期',
|
||||
title: normalizedAccountLabel
|
||||
? `cloudtentacles 登录已过期:${normalizedAccountLabel}`
|
||||
: 'cloudtentacles 登录已过期',
|
||||
body: [
|
||||
normalizedSourceKey ? `账号:${normalizedAccountLabel || normalizedSourceKey}` : '',
|
||||
`接口:${String(pathname || '').trim() || '-'}`,
|
||||
`错误码:${String(errorCode || '').trim() || '-'}`,
|
||||
`原因:${String(message || '').trim() || '登录态已失效,请到后台重新登录'}`,
|
||||
].join('\n'),
|
||||
].filter(Boolean).join('\n'),
|
||||
category: 'cloudtentacles_auth_expired',
|
||||
cooldownKey: ['cloudtentacles_auth_expired', pathname, errorCode].join(':'),
|
||||
cooldownKey: ['cloudtentacles_auth_expired', normalizedSourceKey || 'default', pathname, errorCode].join(':'),
|
||||
cooldownMs: Number(cooldownSeconds || 600) * 1000,
|
||||
})
|
||||
}
|
||||
@@ -97,16 +105,24 @@ export function notifyCloudtentaclesAssetLow({
|
||||
asset = 0,
|
||||
threshold = 500,
|
||||
cooldownSeconds = 1800,
|
||||
sourceKey = '',
|
||||
accountLabel = '',
|
||||
}: JsonObject = {}) {
|
||||
const normalizedSourceKey = String(sourceKey || '').trim()
|
||||
const normalizedAccountLabel = String(accountLabel || '').trim()
|
||||
|
||||
return notifyInternalSafely({
|
||||
title: '快手 Cloud 余额低于阈值',
|
||||
title: normalizedAccountLabel
|
||||
? `快手 Cloud 余额低于阈值:${normalizedAccountLabel}`
|
||||
: '快手 Cloud 余额低于阈值',
|
||||
body: [
|
||||
normalizedSourceKey ? `账号:${normalizedAccountLabel || normalizedSourceKey}` : '',
|
||||
`当前余额:${Number(asset || 0)}`,
|
||||
`提醒阈值:${Number(threshold || 0)}`,
|
||||
'请及时补充 cloudtentacles 余额,避免自动履约失败。',
|
||||
].join('\n'),
|
||||
].filter(Boolean).join('\n'),
|
||||
category: 'cloudtentacles_asset_low',
|
||||
cooldownKey: ['cloudtentacles_asset_low', threshold].join(':'),
|
||||
cooldownKey: ['cloudtentacles_asset_low', normalizedSourceKey || 'default', threshold].join(':'),
|
||||
cooldownMs: Number(cooldownSeconds || 1800) * 1000,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user