Merge pull request #249 from iRubbish/feat/webhook-manual-disable-notification

feat: 增强 webhook 通知功能,支持手动禁用账号通知
This commit is contained in:
Wesley Liddick
2025-08-14 21:47:01 +08:00
committed by GitHub
5 changed files with 191 additions and 28 deletions

View File

@@ -550,6 +550,26 @@ class ClaudeAccountService {
updatedData.updatedAt = new Date().toISOString()
// 检查是否手动禁用了账号如果是则发送webhook通知
if (updates.isActive === 'false' && accountData.isActive === 'true') {
try {
const webhookNotifier = require('../utils/webhookNotifier')
await webhookNotifier.sendAccountAnomalyNotification({
accountId,
accountName: updatedData.name || 'Unknown Account',
platform: 'claude-oauth',
status: 'disabled',
errorCode: 'CLAUDE_OAUTH_MANUALLY_DISABLED',
reason: 'Account manually disabled by administrator'
})
} catch (webhookError) {
logger.error(
'Failed to send webhook notification for manual account disable:',
webhookError
)
}
}
await redis.setClaudeAccount(accountId, updatedData)
logger.success(`📝 Updated Claude account: ${accountId}`)