mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-17 16:06:38 +08:00
fix the issue of model repetition
This commit is contained in:
parent
3808ae8dca
commit
15d3e9819d
@ -14,14 +14,10 @@ type Ability struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetGroupModels(group string) []string {
|
func GetGroupModels(group string) []string {
|
||||||
var abilities []Ability
|
var models []string
|
||||||
//去重 enabled = true
|
// Find distinct models
|
||||||
DB.Where("`group` = ? and enabled = ?", group, true).Find(&abilities)
|
DB.Table("abilities").Where("`group` = ? and enabled = ?", group, true).Distinct("model").Pluck("model", &models)
|
||||||
models := make([]string, 0, len(abilities))
|
return models
|
||||||
for _, ability := range abilities {
|
|
||||||
models = append(models, ability.Model)
|
|
||||||
}
|
|
||||||
return models
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetRandomSatisfiedChannel(group string, model string) (*Channel, error) {
|
func GetRandomSatisfiedChannel(group string, model string) (*Channel, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user