feat: strengthen risk controls and review workflows

This commit is contained in:
hectorzhao
2026-07-26 13:08:12 +08:00
parent b461532075
commit 2ce682c3fc
34 changed files with 2167 additions and 390 deletions
+22
View File
@@ -1136,6 +1136,28 @@ func onlineAccounts() []string {
return accounts
}
// DisconnectAccount closes every live downstream CMPP session for an
// application account. The normal connection-close callback removes registry
// and presence state and reports the disconnect to the API.
func DisconnectAccount(account string) int {
account = strings.TrimSpace(account)
if account == "" {
return 0
}
downstreamRegistry.RLock()
sessions := make([]*downstreamSession, 0)
for _, session := range downstreamRegistry.byConn {
if session != nil && session.account == account && session.conn != nil {
sessions = append(sessions, session)
}
}
downstreamRegistry.RUnlock()
for _, session := range sessions {
session.conn.Close()
}
return len(sessions)
}
func PushReceipt(event DownstreamReceipt) (bool, error) {
result, err := PushReceiptWithResult(event)
return result.Sent, err