feat: 多班级版班级管理系统 v2.0

技术栈:Go (Gin + GORM) + PHP + MySQL 5.7 + Redis

主要功能:
- 多班级完全隔离(class_id 贯穿全系统)
- 后端 Go Gin(端口 56789),Nginx 反代
- 超级管理员独立登录(env 配置,默认账密 admin/Admin123)
- bcrypt 密码加密(无 PASSWORD_SALT)
- 科任老师/课代表新角色
- 课代表作业管理页面
- 排行榜分项排行(操行分/考勤/作业)
- 角色加减分上下限由班主任配置
- 家长改密功能(可开关)
- 班级角色按需开关
- 宿舍号格式:南0-000
- 周度/月度重置功能
- MySQL 5.7 兼容
- 43 轮代码审查 + 全部修复

开发者: Canglan
版权归属: Sea Network Technology Studio
许可证: Apache License 2.0
This commit is contained in:
2026-06-22 10:21:52 +08:00
commit 16059ad3bf
135 changed files with 19933 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
// ===========================================
// 多班级版班级管理系统 - Go 后端
//
// 开发者: Canglan
// 联系方式: admin@sea-studio.top
// 版权归属: Sea Network Technology Studio
// 许可证: Apache License 2.0
//
// 版权所有 © Sea Network Technology Studio
// ===========================================
package model
import "time"
// AdminRole 管理员角色模型,对应 admin_roles 表
type AdminRole struct {
AdminRoleID int `gorm:"column:admin_role_id;primaryKey;autoIncrement" json:"admin_role_id"`
UserID int `gorm:"column:user_id;not null;uniqueIndex:uk_user_class" json:"user_id"`
ClassID int `gorm:"column:class_id;not null;uniqueIndex:uk_user_class;index:idx_admin_role_class" json:"class_id"`
RoleType string `gorm:"column:role_type;type:enum('班主任','班长','学习委员','考勤委员','劳动委员','志愿委员','科任老师','课代表');not null" json:"role_type"`
SubjectID *int `gorm:"column:subject_id" json:"subject_id"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"`
// 虚拟字段JOIN 查询时使用)
RealName *string `gorm:"-" json:"real_name,omitempty"`
Username *string `gorm:"-" json:"username,omitempty"`
UserStatus *int8 `gorm:"-" json:"user_status,omitempty"`
SubjectName *string `gorm:"-" json:"subject_name,omitempty"`
ClassName *string `gorm:"-" json:"class_name,omitempty"`
}
// TableName 指定表名
func (AdminRole) TableName() string {
return "admin_roles"
}

View File

@@ -0,0 +1,53 @@
// ===========================================
// 多班级版班级管理系统 - Go 后端
//
// 开发者: Canglan
// 联系方式: admin@sea-studio.top
// 版权归属: Sea Network Technology Studio
// 许可证: Apache License 2.0
//
// 版权所有 © Sea Network Technology Studio
// ===========================================
package model
import "time"
// Assignment 作业模型,对应 assignments 表
type Assignment struct {
AssignmentID int `gorm:"column:assignment_id;primaryKey;autoIncrement" json:"assignment_id"`
ClassID int `gorm:"column:class_id;not null;index:idx_assignment_class" json:"class_id"`
SubjectID int `gorm:"column:subject_id;not null;index:idx_assignment_subject" json:"subject_id"`
Title string `gorm:"column:title;type:varchar(100);not null" json:"title"`
Description *string `gorm:"column:description;type:text" json:"description"`
Deadline time.Time `gorm:"column:deadline;type:date;not null" json:"deadline"`
CreatedBy int `gorm:"column:created_by;not null" json:"created_by"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"`
// 虚拟字段
SubjectName *string `gorm:"-" json:"subject_name,omitempty"`
}
// TableName 指定表名
func (Assignment) TableName() string {
return "assignments"
}
// AssignmentSubmission 作业提交记录模型,对应 homework_submissions 表
type AssignmentSubmission struct {
SubmissionID int `gorm:"column:submission_id;primaryKey;autoIncrement" json:"submission_id"`
AssignmentID int `gorm:"column:assignment_id;not null;uniqueIndex:uk_assignment_student" json:"assignment_id"`
StudentID int `gorm:"column:student_id;not null;uniqueIndex:uk_assignment_student" json:"student_id"`
Status string `gorm:"column:status;type:enum('submitted','not_submitted','late');default:'not_submitted'" json:"status"`
SubmitTime *time.Time `gorm:"column:submit_time" json:"submit_time"`
Comments *string `gorm:"column:comments;type:text" json:"comments"`
DeductionApplied int8 `gorm:"column:deduction_applied;default:0" json:"deduction_applied"`
DeductionRecordID *int64 `gorm:"column:deduction_record_id" json:"deduction_record_id"`
UpdatedBy *int `gorm:"column:updated_by" json:"updated_by"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"`
}
// TableName 指定表名
func (AssignmentSubmission) TableName() string {
return "homework_submissions"
}

View File

@@ -0,0 +1,38 @@
// ===========================================
// 多班级版班级管理系统 - Go 后端
//
// 开发者: Canglan
// 联系方式: admin@sea-studio.top
// 版权归属: Sea Network Technology Studio
// 许可证: Apache License 2.0
//
// 版权所有 © Sea Network Technology Studio
// ===========================================
package model
import "time"
// AttendanceRecord 考勤记录模型,对应 attendance_records 表
type AttendanceRecord struct {
AttendanceID int `gorm:"column:attendance_id;primaryKey;autoIncrement" json:"attendance_id"`
StudentID int `gorm:"column:student_id;not null" json:"student_id"`
Date time.Time `gorm:"column:date;type:date;not null;index:idx_date" json:"date"`
Slot string `gorm:"column:slot;type:enum('morning','afternoon','evening');default:'morning'" json:"slot"`
Status string `gorm:"column:status;type:enum('present','absent','late','leave');default:'present'" json:"status"`
Reason *string `gorm:"column:reason;type:varchar(255)" json:"reason"`
RecorderID int `gorm:"column:recorder_id;not null" json:"recorder_id"`
DeductionApplied int8 `gorm:"column:deduction_applied;default:0" json:"deduction_applied"`
DeductionRecordID *int64 `gorm:"column:deduction_record_id" json:"deduction_record_id"`
SemesterID *int `gorm:"column:semester_id;index:idx_attendance_semester" json:"semester_id"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"`
// 虚拟字段JOIN 查询时使用)
StudentName *string `gorm:"-" json:"student_name,omitempty"`
StudentNo *string `gorm:"-" json:"student_no,omitempty"`
}
// TableName 指定表名
func (AttendanceRecord) TableName() string {
return "attendance_records"
}

View File

@@ -0,0 +1,60 @@
// ===========================================
// 多班级版班级管理系统 - Go 后端
//
// 开发者: Canglan
// 联系方式: admin@sea-studio.top
// 版权归属: Sea Network Technology Studio
// 许可证: Apache License 2.0
//
// 版权所有 © Sea Network Technology Studio
// ===========================================
package model
import "time"
// Class 班级模型,对应 classes 表
type Class struct {
ClassID int `gorm:"column:class_id;primaryKey;autoIncrement" json:"class_id"`
ClassName string `gorm:"column:class_name;type:varchar(100);uniqueIndex:uk_class_name;not null" json:"class_name"`
Grade *string `gorm:"column:grade;type:varchar(50)" json:"grade"`
Description *string `gorm:"column:description;type:varchar(255)" json:"description"`
Status int8 `gorm:"column:status;default:1" json:"status"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"`
// 虚拟字段
StudentCount int64 `gorm:"-" json:"student_count,omitempty"`
}
// TableName 指定表名
func (Class) TableName() string {
return "classes"
}
// ClassSetting 班级设置模型,对应 class_settings 表
type ClassSetting struct {
SettingID int `gorm:"column:setting_id;primaryKey;autoIncrement" json:"setting_id"`
ClassID int `gorm:"column:class_id;not null;uniqueIndex:uk_class_setting" json:"class_id"`
SettingKey string `gorm:"column:setting_key;type:varchar(50);not null;uniqueIndex:uk_class_setting" json:"setting_key"`
SettingValue string `gorm:"column:setting_value;type:varchar(255);not null" json:"setting_value"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"`
}
// TableName 指定表名
func (ClassSetting) TableName() string {
return "class_settings"
}
// ClassFeature 班级功能开关模型,对应 class_features 表
type ClassFeature struct {
FeatureID int `gorm:"column:feature_id;primaryKey;autoIncrement" json:"feature_id"`
ClassID int `gorm:"column:class_id;not null;uniqueIndex:uk_class_feature" json:"class_id"`
FeatureKey string `gorm:"column:feature_key;type:varchar(50);not null;uniqueIndex:uk_class_feature" json:"feature_key"`
Enabled int8 `gorm:"column:enabled;default:1" json:"enabled"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"`
}
// TableName 指定表名
func (ClassFeature) TableName() string {
return "class_features"
}

View File

@@ -0,0 +1,44 @@
// ===========================================
// 多班级版班级管理系统 - Go 后端
//
// 开发者: Canglan
// 联系方式: admin@sea-studio.top
// 版权归属: Sea Network Technology Studio
// 许可证: Apache License 2.0
//
// 版权所有 © Sea Network Technology Studio
// ===========================================
package model
import "time"
// ConductRecord 操行分记录模型,对应 conduct_records 表
type ConductRecord struct {
RecordID int64 `gorm:"column:record_id;primaryKey;autoIncrement" json:"record_id"`
StudentID int `gorm:"column:student_id;not null;index:idx_conduct_student;index:idx_student_created" json:"student_id"`
PointsChange int `gorm:"column:points_change;not null" json:"points_change"`
Reason string `gorm:"column:reason;type:varchar(255);not null" json:"reason"`
RecorderID int `gorm:"column:recorder_id;not null;index:idx_recorder_id" json:"recorder_id"`
RecorderName *string `gorm:"column:recorder_name;type:varchar(50)" json:"recorder_name"`
RelatedType string `gorm:"column:related_type;type:enum('manual','homework','attendance');default:'manual'" json:"related_type"`
RelatedID *int `gorm:"column:related_id" json:"related_id"`
IsRevoked int8 `gorm:"column:is_revoked;default:0" json:"is_revoked"`
RevokedBy *int `gorm:"column:revoked_by" json:"revoked_by"`
RevokedAt *time.Time `gorm:"column:revoked_at" json:"revoked_at"`
SemesterID *int `gorm:"column:semester_id;index:idx_conduct_semester;index:idx_conduct_type_semester" json:"semester_id"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime;index:idx_student_created" json:"created_at"`
// 虚拟字段JOIN 查询时使用)
StudentName *string `gorm:"-" json:"student_name,omitempty"`
StudentNo *string `gorm:"-" json:"student_no,omitempty"`
RecorderReal *string `gorm:"-" json:"recorder_real,omitempty"`
RevokerName *string `gorm:"-" json:"revoker_name,omitempty"`
TotalPoints *int `gorm:"-" json:"total_points,omitempty"`
ClassID *int `gorm:"-" json:"class_id,omitempty"`
}
// TableName 指定表名
func (ConductRecord) TableName() string {
return "conduct_records"
}

View File

@@ -0,0 +1,50 @@
// ===========================================
// 多班级版班级管理系统 - 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"
}

View File

@@ -0,0 +1,88 @@
// ===========================================
// 多班级版班级管理系统 - Go 后端
//
// 开发者: Canglan
// 联系方式: admin@sea-studio.top
// 版权归属: Sea Network Technology Studio
// 许可证: Apache License 2.0
//
// 版权所有 © Sea Network Technology Studio
// ===========================================
package model
import "time"
// Semester 学期模型,对应 semesters 表
type Semester struct {
SemesterID int `gorm:"column:semester_id;primaryKey;autoIncrement" json:"semester_id"`
SemesterName string `gorm:"column:semester_name;type:varchar(100);not null" json:"semester_name"`
StartDate *time.Time `gorm:"column:start_date;type:date" json:"start_date"`
EndDate *time.Time `gorm:"column:end_date;type:date" json:"end_date"`
IsActive int8 `gorm:"column:is_active;default:0" json:"is_active"`
IsArchived int8 `gorm:"column:is_archived;default:0" json:"is_archived"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"`
// 虚拟字段
ConductCount int64 `gorm:"-" json:"conduct_count,omitempty"`
AttendanceCount int64 `gorm:"-" json:"attendance_count,omitempty"`
CurrentWeek *int `gorm:"-" json:"current_week,omitempty"`
}
// TableName 指定表名
func (Semester) TableName() string {
return "semesters"
}
// SemesterArchive 学期归档快照模型,对应 semester_archives 表
type SemesterArchive struct {
ArchiveID int `gorm:"column:archive_id;primaryKey;autoIncrement" json:"archive_id"`
SemesterID int `gorm:"column:semester_id;not null;index:idx_semester_id" json:"semester_id"`
ClassID int `gorm:"column:class_id;not null;index:idx_archive_class" json:"class_id"`
StudentID int `gorm:"column:student_id;not null" json:"student_id"`
StudentNo string `gorm:"column:student_no;type:varchar(20);not null" json:"student_no"`
StudentName string `gorm:"column:student_name;type:varchar(50);not null" json:"student_name"`
FinalPoints int `gorm:"column:final_points;not null" json:"final_points"`
RankPosition *int `gorm:"column:rank_position" json:"rank_position"`
TotalStudents *int `gorm:"column:total_students" json:"total_students"`
AttendancePresent int `gorm:"column:attendance_present;default:0" json:"attendance_present"`
AttendanceAbsent int `gorm:"column:attendance_absent;default:0" json:"attendance_absent"`
AttendanceLate int `gorm:"column:attendance_late;default:0" json:"attendance_late"`
AttendanceLeave int `gorm:"column:attendance_leave;default:0" json:"attendance_leave"`
HomeworkSubmitted int `gorm:"column:homework_submitted;default:0" json:"homework_submitted"`
HomeworkNotSubmitted int `gorm:"column:homework_not_submitted;default:0" json:"homework_not_submitted"`
HomeworkLate int `gorm:"column:homework_late;default:0" json:"homework_late"`
ArchivedAt time.Time `gorm:"column:archived_at;autoCreateTime" json:"archived_at"`
// 虚拟字段
SemesterName *string `gorm:"-" json:"semester_name,omitempty"`
SStartDate *time.Time `gorm:"-" json:"start_date,omitempty"`
SEndDate *time.Time `gorm:"-" json:"end_date,omitempty"`
}
// TableName 指定表名
func (SemesterArchive) TableName() string {
return "semester_archives"
}
// PeriodArchive 周期归档快照模型,对应 period_archives 表
type PeriodArchive struct {
ArchiveID int `gorm:"column:archive_id;primaryKey;autoIncrement" json:"archive_id"`
ClassID int `gorm:"column:class_id;not null;index:idx_period_archive_class" json:"class_id"`
PeriodType string `gorm:"column:period_type;type:enum('weekly','monthly');not null;index:idx_period_archive_type" json:"period_type"`
PeriodLabel string `gorm:"column:period_label;type:varchar(50);not null;index:idx_period_archive_type" json:"period_label"`
StudentID int `gorm:"column:student_id;not null" json:"student_id"`
StudentNo string `gorm:"column:student_no;type:varchar(20);not null" json:"student_no"`
StudentName string `gorm:"column:student_name;type:varchar(50);not null" json:"student_name"`
FinalPoints int `gorm:"column:final_points;not null" json:"final_points"`
RankPosition *int `gorm:"column:rank_position" json:"rank_position"`
TotalStudents *int `gorm:"column:total_students" json:"total_students"`
ArchivedAt time.Time `gorm:"column:archived_at;autoCreateTime" json:"archived_at"`
ResetBy string `gorm:"column:reset_by;type:varchar(20);default:auto" json:"reset_by"`
OperatorID *int `gorm:"column:operator_id" json:"operator_id"`
}
// TableName 指定表名
func (PeriodArchive) TableName() string {
return "period_archives"
}

View File

@@ -0,0 +1,37 @@
// ===========================================
// 多班级版班级管理系统 - Go 后端
//
// 开发者: Canglan
// 联系方式: admin@sea-studio.top
// 版权归属: Sea Network Technology Studio
// 许可证: Apache License 2.0
//
// 版权所有 © Sea Network Technology Studio
// ===========================================
package model
import "time"
// Student 学生模型,对应 students 表
type Student struct {
StudentID int `gorm:"column:student_id;primaryKey;autoIncrement" json:"student_id"`
StudentNo string `gorm:"column:student_no;type:varchar(20);not null" json:"student_no"`
ClassID int `gorm:"column:class_id;not null;index:idx_student_class" json:"class_id"`
Name string `gorm:"column:name;type:varchar(50);not null" json:"name"`
TotalPoints int `gorm:"column:total_points;default:60" json:"total_points"`
ParentAccount *string `gorm:"column:parent_account;type:varchar(50)" json:"parent_account"`
DormitoryNumber *string `gorm:"column:dormitory_number;type:varchar(20)" json:"dormitory_number"` // 格式南0-000
Status int8 `gorm:"column:status;default:1" json:"status"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"`
PointsUpdatedAt time.Time `gorm:"column:points_updated_at;autoCreateTime" json:"points_updated_at"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"`
// 虚拟字段JOIN 查询时使用,不映射到数据库)
ClassName *string `gorm:"-" json:"class_name,omitempty"`
}
// TableName 指定表名
func (Student) TableName() string {
return "students"
}

View File

@@ -0,0 +1,29 @@
// ===========================================
// 多班级版班级管理系统 - Go 后端
//
// 开发者: Canglan
// 联系方式: admin@sea-studio.top
// 版权归属: Sea Network Technology Studio
// 许可证: Apache License 2.0
//
// 版权所有 © Sea Network Technology Studio
// ===========================================
package model
import "time"
// Subject 科目模型,对应 subjects 表
type Subject struct {
SubjectID int `gorm:"column:subject_id;primaryKey;autoIncrement" json:"subject_id"`
SubjectName string `gorm:"column:subject_name;type:varchar(50);uniqueIndex:uk_subject_name;not null" json:"subject_name"`
SubjectCode *string `gorm:"column:subject_code;type:varchar(20)" json:"subject_code"`
IsActive int8 `gorm:"column:is_active;default:1" json:"is_active"`
SortOrder int `gorm:"column:sort_order;default:0" json:"sort_order"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"`
}
// TableName 指定表名
func (Subject) TableName() string {
return "subjects"
}

View File

@@ -0,0 +1,31 @@
// ===========================================
// 多班级版班级管理系统 - Go 后端
//
// 开发者: Canglan
// 联系方式: admin@sea-studio.top
// 版权归属: Sea Network Technology Studio
// 许可证: Apache License 2.0
//
// 版权所有 © Sea Network Technology Studio
// ===========================================
package model
import "time"
// SuperAdmin 超级管理员模型,对应 super_admins 表
type SuperAdmin struct {
ID int `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
Username string `gorm:"column:username;type:varchar(50);uniqueIndex;not null" json:"username"`
PasswordHash string `gorm:"column:password_hash;type:varchar(60);not null" json:"-"`
RealName string `gorm:"column:real_name;type:varchar(50);not null" json:"real_name"`
Status int8 `gorm:"column:status;default:1" json:"status"`
NeedChangePassword int8 `gorm:"column:need_change_password;default:1" json:"need_change_password"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"`
}
// TableName 指定表名
func (SuperAdmin) TableName() string {
return "super_admins"
}

View File

@@ -0,0 +1,26 @@
// ===========================================
// 多班级版班级管理系统 - Go 后端
//
// 开发者: Canglan
// 联系方式: admin@sea-studio.top
// 版权归属: Sea Network Technology Studio
// 许可证: Apache License 2.0
//
// 版权所有 © Sea Network Technology Studio
// ===========================================
package model
import "time"
// SystemSetting 系统设置模型,对应 system_settings 表
type SystemSetting struct {
SettingKey string `gorm:"column:setting_key;type:varchar(50);primaryKey;not null" json:"setting_key"`
SettingValue string `gorm:"column:setting_value;type:varchar(255);not null" json:"setting_value"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime" json:"updated_at"`
}
// TableName 指定表名
func (SystemSetting) TableName() string {
return "system_settings"
}

View File

@@ -0,0 +1,34 @@
// ===========================================
// 多班级版班级管理系统 - Go 后端
//
// 开发者: Canglan
// 联系方式: admin@sea-studio.top
// 版权归属: Sea Network Technology Studio
// 许可证: Apache License 2.0
//
// 版权所有 © Sea Network Technology Studio
// ===========================================
package model
import "time"
// User 用户模型,对应 users 表
type User struct {
UserID int `gorm:"column:user_id;primaryKey;autoIncrement" json:"user_id"`
Username string `gorm:"column:username;type:varchar(50);uniqueIndex;not null" json:"username"`
PasswordHash string `gorm:"column:password_hash;type:varchar(60);not null" json:"-"`
RealName string `gorm:"column:real_name;type:varchar(50);not null" json:"real_name"`
UserType string `gorm:"column:user_type;type:enum('student','parent','admin','super_admin');not null" json:"user_type"`
StudentID *int `gorm:"column:student_id" json:"student_id"`
Status int8 `gorm:"column:status;default:1" json:"status"`
NeedChangePassword int8 `gorm:"column:need_change_password;default:1" json:"need_change_password"`
LastLoginTime *time.Time `gorm:"column:last_login_time" json:"last_login_time"`
LastLoginIP *string `gorm:"column:last_login_ip;type:varchar(45)" json:"last_login_ip"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"`
}
// TableName 指定表名
func (User) TableName() string {
return "users"
}