mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-15 15:30:26 +00:00
feat: automatically disable channel when error occurred (#59)
This commit is contained in:
@@ -86,15 +86,15 @@ func (channel *Channel) UpdateResponseTime(responseTime int64) {
|
||||
}
|
||||
}
|
||||
|
||||
func (channel *Channel) UpdateStatus(status int) {
|
||||
err := DB.Model(channel).Update("status", status).Error
|
||||
if err != nil {
|
||||
common.SysError("failed to update response time: " + err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func (channel *Channel) Delete() error {
|
||||
var err error
|
||||
err = DB.Delete(channel).Error
|
||||
return err
|
||||
}
|
||||
|
||||
func UpdateChannelStatusById(id int, status int) {
|
||||
err := DB.Model(&Channel{}).Where("id = ?", id).Update("status", status).Error
|
||||
if err != nil {
|
||||
common.SysError("failed to update channel status: " + err.Error())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user