feat: verify and activate support group binding

This commit is contained in:
姚章浩
2026-08-13 18:22:43 +08:00
parent 4dbc20ee74
commit 6f24743be2
10 changed files with 239 additions and 10 deletions
+11 -2
View File
@@ -29,6 +29,7 @@ type ControllerRepository interface {
IsAdministrator(context.Context, string, string) (bool, error)
SetPreference(context.Context, string, string, string, string) error
SaveBinding(context.Context, ResourceBinding) error
TestAndActivateSupportGroup(context.Context, ResourceBinding) error
DetectBootstrapCandidate(context.Context, BootstrapCandidate) error
GetSettingSession(context.Context, string, string) (SettingSession, bool, error)
SaveSettingSession(context.Context, SettingSession) error
@@ -123,9 +124,17 @@ func (c *Controller) Handle(ctx context.Context, in SettingInput) (string, error
if in.ConversationType != "group" || strings.TrimSpace(in.ConversationID) == "" {
return "请在目标技术支持群中@机器人发送 /setting support。", nil
}
err = c.repo.SaveBinding(ctx, ResourceBinding{Kind: "support_group", TenantKey: in.TenantKey, ConversationID: in.ConversationID, ConversationTitle: in.ConversationTitle, CreatedByStaffID: in.StaffID})
binding := ResourceBinding{Kind: "support_group", TenantKey: in.TenantKey, ConversationID: in.ConversationID, ConversationTitle: in.ConversationTitle, CreatedByStaffID: in.StaffID}
if len(args) == 2 && strings.EqualFold(args[1], "test") {
err = c.repo.TestAndActivateSupportGroup(ctx, binding)
if err == nil {
return "✅ 测试成功,当前群已激活为技术支持群。", nil
}
break
}
err = c.repo.SaveBinding(ctx, binding)
if err == nil {
return "✅ 当前群已保存为技术支持群(待后台验证)。", nil
return "✅ 当前群已保存为技术支持群(待验证)。确认发送测试消息后,请在本群@机器人发送 /setting support test。", nil
}
case "question", "faq":
if len(args) != 2 {