package model import ( "time" ) // Admin 管理员实体 type Admin struct { Id uint64 `json:"id" orm:"id,primary"` Username string `json:"username" orm:"username"` Password string `json:"-" orm:"password"` RealName string `json:"real_name" orm:"real_name"` Email string `json:"email" orm:"email"` Phone string `json:"phone" orm:"phone"` Avatar string `json:"avatar" orm:"avatar"` RoleId uint64 `json:"role_id" orm:"role_id"` Status uint8 `json:"status" orm:"status"` LastLoginAt *time.Time `json:"last_login_at" orm:"last_login_at"` LastLoginIp string `json:"last_login_ip" orm:"last_login_ip"` CreatedAt *time.Time `json:"created_at" orm:"created_at"` UpdatedAt *time.Time `json:"updated_at" orm:"updated_at"` DeletedAt uint64 `json:"deleted_at" orm:"deleted_at"` } // LoginRequest 登录请求 type LoginRequest struct { Username string `json:"username" v:"required|length:3,30#用户名不能为空|用户名长度为3到30位"` Password string `json:"password" v:"required|length:6,30#密码不能为空|密码长度为6到30位"` } // LoginResponse 登录响应 type LoginResponse struct { Token string `json:"token"` Admin *Admin `json:"admin"` } // AdminListRequest 管理员列表请求 type AdminListRequest struct { Page int `json:"page" v:"min:1#页码不能小于1"` PageSize int `json:"page_size" v:"min:1|max:100#每页数量不能小于1且不能大于100"` Username string `json:"username"` RealName string `json:"real_name"` Status *int `json:"status"` } // CreateAdminRequest 创建管理员请求 type CreateAdminRequest struct { Username string `json:"username" v:"required|length:3,30#用户名不能为空|用户名长度为3到30位"` Password string `json:"password" v:"required|length:6,30#密码不能为空|密码长度为6到30位"` RealName string `json:"real_name" v:"required|length:2,20#真实姓名不能为空|真实姓名长度为2到20位"` Email string `json:"email" v:"email#邮箱格式不正确"` Phone string `json:"phone" v:"phone#手机号格式不正确"` RoleId uint64 `json:"role_id" v:"required|min:1#角色ID不能为空"` Status uint8 `json:"status" v:"in:0,1#状态值只能为0或1"` } // UpdateAdminRequest 更新管理员请求 type UpdateAdminRequest struct { RealName string `json:"real_name" v:"required|length:2,20#真实姓名不能为空|真实姓名长度为2到20位"` Email string `json:"email" v:"email#邮箱格式不正确"` Phone string `json:"phone" v:"phone#手机号格式不正确"` RoleId uint64 `json:"role_id" v:"required|min:1#角色ID不能为空"` Status uint8 `json:"status" v:"in:0,1#状态值只能为0或1"` } // AdminLoginRequest 管理员登录请求 type AdminLoginRequest struct { Username string `json:"username" v:"required|length:3,30#用户名不能为空|用户名长度为3到30位"` Password string `json:"password" v:"required|length:6,30#密码不能为空|密码长度为6到30位"` } // AdminLoginResponse 管理员登录响应 type AdminLoginResponse struct { Token string `json:"token"` ExpiresIn int `json:"expires_in"` Admin *Admin `json:"admin"` }