feat(verification): add user identity verification system
Implement a complete user identity verification system with support for multiple identity types (student, teacher, staff, alumni). The system includes user-facing verification submission and status checking endpoints, admin endpoints for reviewing verification requests, middleware for protecting verification-required routes, and integration with the user model to track verification status.
This commit is contained in:
@@ -16,6 +16,28 @@ const (
|
||||
UserStatusInactive UserStatus = "inactive"
|
||||
)
|
||||
|
||||
// UserIdentity 用户身份类型
|
||||
type UserIdentity string
|
||||
|
||||
const (
|
||||
UserIdentityGeneral UserIdentity = "general" // 普通用户
|
||||
UserIdentityStudent UserIdentity = "student" // 学生
|
||||
UserIdentityTeacher UserIdentity = "teacher" // 教师
|
||||
UserIdentityStaff UserIdentity = "staff" // 职工
|
||||
UserIdentityAlumni UserIdentity = "alumni" // 校友
|
||||
UserIdentityExternal UserIdentity = "external" // 外部人员
|
||||
)
|
||||
|
||||
// VerificationStatus 审核状态
|
||||
type VerificationStatus string
|
||||
|
||||
const (
|
||||
VerificationStatusNotSubmitted VerificationStatus = "not_submitted" // 未提交
|
||||
VerificationStatusPending VerificationStatus = "pending" // 审核中
|
||||
VerificationStatusApproved VerificationStatus = "approved" // 已通过
|
||||
VerificationStatusRejected VerificationStatus = "rejected" // 已拒绝
|
||||
)
|
||||
|
||||
// User 用户实体
|
||||
type User struct {
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
@@ -42,6 +64,10 @@ type User struct {
|
||||
FollowersCount int `json:"followers_count" gorm:"default:0"`
|
||||
FollowingCount int `json:"following_count" gorm:"default:0"`
|
||||
|
||||
// 身份认证
|
||||
Identity UserIdentity `json:"identity" gorm:"type:varchar(20);default:general"`
|
||||
VerificationStatus VerificationStatus `json:"verification_status" gorm:"type:varchar(20);default:not_submitted"`
|
||||
|
||||
// 状态
|
||||
Status UserStatus `json:"status" gorm:"type:varchar(20);default:active"`
|
||||
LastLoginAt *time.Time `json:"last_login_at" gorm:"type:timestamp"`
|
||||
|
||||
Reference in New Issue
Block a user