package models // User 用户模型 type User struct { ID uint `json:"id"` Username string `json:"username"` Email string `json:"email"` Password string `json:"password,omitempty" gorm:"-"` // Virtual field for input PasswordHash string `json:"-"` RoleID uint `json:"roleId"` Role string `json:"role"` // 保持兼容,或者作为Role Name IsActive int `json:"isActive"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` DeletedAt int64 `json:"deletedAt"` } // UserResponse 用户响应模型 type UserResponse struct { ID uint `json:"id"` Username string `json:"username"` Email string `json:"email"` RoleID uint `json:"roleId"` Role string `json:"role"` IsActive int `json:"isActive"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` } // LoginRequest 登录请求模型 type LoginRequest struct { Username string `json:"username" binding:"required"` Password string `json:"password" binding:"required"` } // LoginResponse 登录响应模型 type LoginResponse struct { Token string `json:"token"` User UserResponse `json:"user"` Expire int64 `json:"expire"` }