2026-01-15 13:51:44 +08:00
|
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
|
|
// User 用户模型
|
|
|
|
|
|
type User struct {
|
2026-01-16 13:01:21 +08:00
|
|
|
|
ID uint `json:"id"`
|
|
|
|
|
|
Username string `json:"username"`
|
|
|
|
|
|
Email string `json:"email"`
|
|
|
|
|
|
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"`
|
2026-01-15 13:51:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 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"`
|
|
|
|
|
|
}
|