Files
jiacrontab/models/group.go
jiazhizhong 1279635d7f fix
2022-03-10 17:09:03 +08:00

25 lines
347 B
Go

package models
import (
"gorm.io/gorm"
)
var SuperGroup Group
type Group struct {
gorm.Model
Name string `json:"name" gorm:"not null;uniqueIndex;size:500"`
}
func (g *Group) Save() error {
if g.ID == 0 {
return DB().Create(g).Error
}
return DB().Save(g).Error
}
func init() {
SuperGroup.ID = 1
SuperGroup.Name = "超级管理员"
}