mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-14 14:30:26 +00:00
feat: able to only test disabled channels (#1090)
This commit is contained in:
@@ -32,12 +32,15 @@ type Channel struct {
|
||||
Config string `json:"config"`
|
||||
}
|
||||
|
||||
func GetAllChannels(startIdx int, num int, selectAll bool) ([]*Channel, error) {
|
||||
func GetAllChannels(startIdx int, num int, scope string) ([]*Channel, error) {
|
||||
var channels []*Channel
|
||||
var err error
|
||||
if selectAll {
|
||||
switch scope {
|
||||
case "all":
|
||||
err = DB.Order("id desc").Find(&channels).Error
|
||||
} else {
|
||||
case "disabled":
|
||||
err = DB.Order("id desc").Where("status = ? or status = ?", common.ChannelStatusAutoDisabled, common.ChannelStatusManuallyDisabled).Find(&channels).Error
|
||||
default:
|
||||
err = DB.Order("id desc").Limit(num).Offset(startIdx).Omit("key").Find(&channels).Error
|
||||
}
|
||||
return channels, err
|
||||
|
Reference in New Issue
Block a user