Fix: test error / missing AfterFind hook in user model

This commit is contained in:
HFO4
2019-11-27 15:27:19 +08:00
parent 16067c3ac8
commit b3ef833afd
5 changed files with 30 additions and 10 deletions

View File

@@ -21,6 +21,19 @@ type Group struct {
PolicyList []uint `gorm:"-"`
}
// GetAria2Option 获取用户离线下载设备
// TODO:测试
func (group *Group) GetAria2Option() [3]bool {
if len(group.Aria2Option) != 3 {
return [3]bool{false, false, false}
}
return [3]bool{
group.Aria2Option[0] == '1',
group.Aria2Option[1] == '1',
group.Aria2Option[2] == '1',
}
}
// GetGroupByID 用ID获取用户组
func GetGroupByID(ID interface{}) (Group, error) {
var group Group