mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 00:53:33 +00:00
feat: 增强 webhook 通知功能,支持手动禁用账号通知
- 添加手动禁用账号时的 webhook 通知功能 - 支持所有账号类型:Claude OAuth、Claude Console、Gemini - 新增错误代码:MANUALLY_DISABLED 系列 - 更新 README.md 文档,添加完整的 webhook 配置说明 - 包含企业微信配置示例和测试方法 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -455,6 +455,23 @@ async function updateAccount(accountId, updates) {
|
||||
}
|
||||
}
|
||||
|
||||
// 检查是否手动禁用了账号,如果是则发送webhook通知
|
||||
if (updates.isActive === 'false' && existingAccount.isActive !== 'false') {
|
||||
try {
|
||||
const webhookNotifier = require('../utils/webhookNotifier')
|
||||
await webhookNotifier.sendAccountAnomalyNotification({
|
||||
accountId,
|
||||
accountName: updates.name || existingAccount.name || 'Unknown Account',
|
||||
platform: 'gemini',
|
||||
status: 'disabled',
|
||||
errorCode: 'GEMINI_MANUALLY_DISABLED',
|
||||
reason: 'Account manually disabled by administrator'
|
||||
})
|
||||
} catch (webhookError) {
|
||||
logger.error('Failed to send webhook notification for manual account disable:', webhookError)
|
||||
}
|
||||
}
|
||||
|
||||
await client.hset(`${GEMINI_ACCOUNT_KEY_PREFIX}${accountId}`, updates)
|
||||
|
||||
logger.info(`Updated Gemini account: ${accountId}`)
|
||||
|
||||
Reference in New Issue
Block a user