- 移除日志初始化代码,改为使用 utils.InitLogger() - 删除用户模型定义,移至 models 包 - 抽离路由处理逻辑到 handlers 包 - 使用 middleware 包中的 AuthRequired 中间件 - 优化数据库连接和迁移逻辑 - 简化 main 函数,提高代码可读性和维护性
15 lines
251 B
Go
15 lines
251 B
Go
package models
|
|
|
|
import (
|
|
"github.com/jinzhu/gorm"
|
|
)
|
|
|
|
type User struct {
|
|
gorm.Model
|
|
FullName string `gorm:"not null"`
|
|
RegionID uint `gorm:"not null"`
|
|
Mobile string `gorm:"unique;not null"`
|
|
Password string `gorm:"not null"`
|
|
Region Region
|
|
}
|