MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / DisableChannel

Function DisableChannel

service/channel.go:20–27  ·  view source on GitHub ↗

disable & notify

(channelError types.ChannelError, reason string)

Source from the content-addressed store, hash-verified

18
19// disable & notify
20func DisableChannel(channelError types.ChannelError, reason string) {
21 success := model.UpdateChannelStatus(channelError.ChannelId, channelError.UsingKey, common.ChannelStatusAutoDisabled, reason)
22 if success {
23 subject := fmt.Sprintf("通道「%s」(#%d)已被禁用", channelError.ChannelName, channelError.ChannelId)
24 content := fmt.Sprintf("通道「%s」(#%d)已被禁用,原因:%s", channelError.ChannelName, channelError.ChannelId, reason)
25 NotifyRootUser(formatNotifyType(channelError.ChannelId, common.ChannelStatusAutoDisabled), subject, content)
26 }
27}
28
29func EnableChannel(channelId int, usingKey string, channelName string) {
30 success := model.UpdateChannelStatus(channelId, usingKey, common.ChannelStatusEnabled, "")

Callers 2

updateAllChannelsBalanceFunction · 0.92
processChannelErrorFunction · 0.92

Calls 3

UpdateChannelStatusFunction · 0.92
NotifyRootUserFunction · 0.85
formatNotifyTypeFunction · 0.85

Tested by

no test coverage detected