- 后端从 Python FastAPI 重写为 Go Gin(端口 56789) - 多班级完全隔离 - 超级管理员独立登录 - 课代表作业管理、排行榜分项排行 - 角色加减分上下限可配置 - 家长改密功能(可开关) - 周度/月度重置功能 - MySQL 5.7 兼容 - 43轮代码审查+全部修复 - Apache 2.0 许可证
51 lines
2.3 KiB
Go
51 lines
2.3 KiB
Go
// ===========================================
|
|
// 多班级版班级管理系统 - Go 后端
|
|
//
|
|
// 开发者: Canglan
|
|
// 联系方式: admin@sea-studio.top
|
|
// 版权归属: Sea Network Technology Studio
|
|
// 许可证: Apache License 2.0
|
|
//
|
|
// 版权所有 © Sea Network Technology Studio
|
|
// ===========================================
|
|
|
|
package model
|
|
|
|
import "time"
|
|
|
|
// OperationLog 操作日志模型,对应 operation_logs 表
|
|
type OperationLog struct {
|
|
LogID int64 `gorm:"column:log_id;primaryKey;autoIncrement" json:"log_id"`
|
|
OperatorID int `gorm:"column:operator_id;not null;index:idx_operator_created" json:"operator_id"`
|
|
OperatorName *string `gorm:"column:operator_name;type:varchar(50)" json:"operator_name"`
|
|
OperatorRole *string `gorm:"column:operator_role;type:varchar(50)" json:"operator_role"`
|
|
ClassID *int `gorm:"column:class_id;index:idx_operation_class" json:"class_id"`
|
|
OperationType string `gorm:"column:operation_type;type:varchar(50);not null" json:"operation_type"`
|
|
TargetType *string `gorm:"column:target_type;type:varchar(50)" json:"target_type"`
|
|
TargetID *int `gorm:"column:target_id" json:"target_id"`
|
|
Details *string `gorm:"column:details;type:text" json:"details"`
|
|
IPAddress *string `gorm:"column:ip_address;type:varchar(45)" json:"ip_address"`
|
|
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime;index:idx_operator_created" json:"created_at"`
|
|
}
|
|
|
|
// TableName 指定表名
|
|
func (OperationLog) TableName() string {
|
|
return "operation_logs"
|
|
}
|
|
|
|
// LoginLog 登录日志模型,对应 login_logs 表
|
|
type LoginLog struct {
|
|
LogID int64 `gorm:"column:log_id;primaryKey;autoIncrement" json:"log_id"`
|
|
Username string `gorm:"column:username;type:varchar(50);not null;index:idx_username_created" json:"username"`
|
|
LoginResult int8 `gorm:"column:login_result;not null" json:"login_result"`
|
|
FailReason *string `gorm:"column:fail_reason;type:varchar(100)" json:"fail_reason"`
|
|
IPAddress *string `gorm:"column:ip_address;type:varchar(45)" json:"ip_address"`
|
|
UserAgent *string `gorm:"column:user_agent;type:varchar(255)" json:"user_agent"`
|
|
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime;index:idx_username_created" json:"created_at"`
|
|
}
|
|
|
|
// TableName 指定表名
|
|
func (LoginLog) TableName() string {
|
|
return "login_logs"
|
|
}
|