28 lines
819 B
Go
28 lines
819 B
Go
package admin
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Admin struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `gorm:"comment:创建时间" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"comment:更新时间" json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index;comment:删除时间" json:"-"`
|
|
|
|
Username string `gorm:"size:50;uniqueIndex;not null;comment:用户名" json:"username"`
|
|
Password string `gorm:"size:255;not null;comment:密码(bcrypt)" json:"-"`
|
|
Role string `gorm:"size:20;default:admin;comment:角色" json:"role"`
|
|
LastLoginAt *time.Time `gorm:"comment:最后登录时间" json:"last_login_at,omitempty"`
|
|
}
|
|
|
|
func (Admin) TableName() string {
|
|
return "admins"
|
|
}
|
|
|
|
func (Admin) TableComment() string {
|
|
return "管理员表"
|
|
}
|