更新 Go 版本至 1.23.0,添加管理员功能,包括管理员登录、用户和客户端管理,新增相应的模板和中间件,优化数据库模型以支持管理员管理。

This commit is contained in:
2025-04-17 01:47:10 +08:00
parent a3f3cc17cf
commit 83c82f7135
18 changed files with 686 additions and 21 deletions

21
models/admin.go Normal file
View File

@@ -0,0 +1,21 @@
package models
import (
"time"
"gorm.io/gorm"
)
type Admin struct {
gorm.Model
Username string `gorm:"uniqueIndex;not null"`
Password string `gorm:"not null"`
Email string `gorm:"uniqueIndex"`
LastLogin time.Time
IsActive bool `gorm:"default:true"`
Role string `gorm:"type:varchar(20);default:'admin'"`
}
func (a *Admin) TableName() string {
return "admins"
}