基础架构
This commit is contained in:
44
internal/application/admin/dto/commands/admin_commands.go
Normal file
44
internal/application/admin/dto/commands/admin_commands.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package commands
|
||||
|
||||
// AdminLoginCommand 管理员登录命令
|
||||
type AdminLoginCommand struct {
|
||||
Username string `json:"username" binding:"required"`
|
||||
Password string `json:"password" binding:"required"`
|
||||
}
|
||||
|
||||
// CreateAdminCommand 创建管理员命令
|
||||
type CreateAdminCommand struct {
|
||||
Username string `json:"username" binding:"required"`
|
||||
Password string `json:"password" binding:"required"`
|
||||
Email string `json:"email" binding:"required,email"`
|
||||
Phone string `json:"phone"`
|
||||
RealName string `json:"real_name" binding:"required"`
|
||||
Role string `json:"role" binding:"required"`
|
||||
Permissions []string `json:"permissions"`
|
||||
OperatorID string `json:"-"`
|
||||
}
|
||||
|
||||
// UpdateAdminCommand 更新管理员命令
|
||||
type UpdateAdminCommand struct {
|
||||
AdminID string `json:"-"`
|
||||
Email string `json:"email" binding:"email"`
|
||||
Phone string `json:"phone"`
|
||||
RealName string `json:"real_name"`
|
||||
Role string `json:"role"`
|
||||
IsActive *bool `json:"is_active"`
|
||||
Permissions []string `json:"permissions"`
|
||||
OperatorID string `json:"-"`
|
||||
}
|
||||
|
||||
// ChangeAdminPasswordCommand 修改密码命令
|
||||
type ChangeAdminPasswordCommand struct {
|
||||
AdminID string `json:"-"`
|
||||
OldPassword string `json:"old_password" binding:"required"`
|
||||
NewPassword string `json:"new_password" binding:"required"`
|
||||
}
|
||||
|
||||
// DeleteAdminCommand 删除管理员命令
|
||||
type DeleteAdminCommand struct {
|
||||
AdminID string `json:"-"`
|
||||
OperatorID string `json:"-"`
|
||||
}
|
||||
16
internal/application/admin/dto/queries/admin_queries.go
Normal file
16
internal/application/admin/dto/queries/admin_queries.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package queries
|
||||
|
||||
// ListAdminsQuery 获取管理员列表查询
|
||||
type ListAdminsQuery struct {
|
||||
Page int `form:"page" binding:"min=1"`
|
||||
PageSize int `form:"page_size" binding:"min=1,max=100"`
|
||||
Username string `form:"username"`
|
||||
Email string `form:"email"`
|
||||
Role string `form:"role"`
|
||||
IsActive *bool `form:"is_active"`
|
||||
}
|
||||
|
||||
// GetAdminInfoQuery 获取管理员信息查询
|
||||
type GetAdminInfoQuery struct {
|
||||
AdminID string `uri:"id" binding:"required"`
|
||||
}
|
||||
45
internal/application/admin/dto/responses/admin_responses.go
Normal file
45
internal/application/admin/dto/responses/admin_responses.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package responses
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"tyapi-server/internal/domains/admin/entities"
|
||||
)
|
||||
|
||||
// AdminLoginResponse 管理员登录响应
|
||||
type AdminLoginResponse struct {
|
||||
Token string `json:"token"`
|
||||
ExpiresAt time.Time `json:"expires_at"`
|
||||
Admin AdminInfoResponse `json:"admin"`
|
||||
}
|
||||
|
||||
// AdminInfoResponse 管理员信息响应
|
||||
type AdminInfoResponse struct {
|
||||
ID string `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Phone string `json:"phone"`
|
||||
RealName string `json:"real_name"`
|
||||
Role entities.AdminRole `json:"role"`
|
||||
IsActive bool `json:"is_active"`
|
||||
LastLoginAt *time.Time `json:"last_login_at"`
|
||||
LoginCount int `json:"login_count"`
|
||||
Permissions []string `json:"permissions"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
// AdminListResponse 管理员列表响应
|
||||
type AdminListResponse struct {
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
Size int `json:"size"`
|
||||
Admins []AdminInfoResponse `json:"admins"`
|
||||
}
|
||||
|
||||
// AdminStatsResponse 管理员统计响应
|
||||
type AdminStatsResponse struct {
|
||||
TotalAdmins int64 `json:"total_admins"`
|
||||
ActiveAdmins int64 `json:"active_admins"`
|
||||
TodayLogins int64 `json:"today_logins"`
|
||||
TotalOperations int64 `json:"total_operations"`
|
||||
}
|
||||
Reference in New Issue
Block a user