f
This commit is contained in:
15
internal/application/user/dto/commands/blacklist_commands.go
Normal file
15
internal/application/user/dto/commands/blacklist_commands.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package commands
|
||||
|
||||
// BlacklistUserCommand 管理员将用户列入黑名单
|
||||
type BlacklistUserCommand struct {
|
||||
UserID string `json:"-"`
|
||||
OperatorUserID string `json:"-"`
|
||||
Reason string `json:"reason" binding:"required"`
|
||||
Source string `json:"source"` // self / police / test,默认 self
|
||||
}
|
||||
|
||||
// UnblacklistUserCommand 管理员将用户移出黑名单
|
||||
type UnblacklistUserCommand struct {
|
||||
UserID string `json:"-"`
|
||||
OperatorUserID string `json:"-"`
|
||||
}
|
||||
@@ -8,24 +8,26 @@ type ListUsersQuery struct {
|
||||
PageSize int `json:"page_size" validate:"min=1,max=100"`
|
||||
Phone string `json:"phone"`
|
||||
UserType string `json:"user_type"` // 用户类型: user/admin
|
||||
IsActive *bool `json:"is_active"` // 是否激活
|
||||
IsCertified *bool `json:"is_certified"` // 是否已认证
|
||||
CompanyName string `json:"company_name"` // 企业名称
|
||||
StartDate string `json:"start_date"`
|
||||
EndDate string `json:"end_date"`
|
||||
IsActive *bool `json:"is_active"` // 是否激活
|
||||
IsCertified *bool `json:"is_certified"` // 是否已认证
|
||||
IsBlacklisted *bool `json:"is_blacklisted"` // 是否黑名单
|
||||
CompanyName string `json:"company_name"` // 企业名称
|
||||
StartDate string `json:"start_date"`
|
||||
EndDate string `json:"end_date"`
|
||||
}
|
||||
|
||||
// ToDomainQuery 转换为领域查询对象
|
||||
func (q *ListUsersQuery) ToDomainQuery() *queries.ListUsersQuery {
|
||||
return &queries.ListUsersQuery{
|
||||
Page: q.Page,
|
||||
PageSize: q.PageSize,
|
||||
Phone: q.Phone,
|
||||
UserType: q.UserType,
|
||||
IsActive: q.IsActive,
|
||||
IsCertified: q.IsCertified,
|
||||
CompanyName: q.CompanyName,
|
||||
StartDate: q.StartDate,
|
||||
EndDate: q.EndDate,
|
||||
Page: q.Page,
|
||||
PageSize: q.PageSize,
|
||||
Phone: q.Phone,
|
||||
UserType: q.UserType,
|
||||
IsActive: q.IsActive,
|
||||
IsCertified: q.IsCertified,
|
||||
IsBlacklisted: q.IsBlacklisted,
|
||||
CompanyName: q.CompanyName,
|
||||
StartDate: q.StartDate,
|
||||
EndDate: q.EndDate,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,22 +4,23 @@ import "time"
|
||||
|
||||
// UserListItem 用户列表项
|
||||
type UserListItem struct {
|
||||
ID string `json:"id"`
|
||||
Phone string `json:"phone"`
|
||||
UserType string `json:"user_type"`
|
||||
Username string `json:"username"`
|
||||
IsActive bool `json:"is_active"`
|
||||
IsCertified bool `json:"is_certified"`
|
||||
LoginCount int `json:"login_count"`
|
||||
LastLoginAt *time.Time `json:"last_login_at"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
|
||||
// 企业信息
|
||||
ID string `json:"id"`
|
||||
Phone string `json:"phone"`
|
||||
UserType string `json:"user_type"`
|
||||
Username string `json:"username"`
|
||||
IsActive bool `json:"is_active"`
|
||||
IsCertified bool `json:"is_certified"`
|
||||
IsBlacklisted bool `json:"is_blacklisted"`
|
||||
BlacklistReason string `json:"blacklist_reason,omitempty"`
|
||||
BlacklistSource string `json:"blacklist_source,omitempty"`
|
||||
BlacklistedAt *time.Time `json:"blacklisted_at,omitempty"`
|
||||
LoginCount int `json:"login_count"`
|
||||
LastLoginAt *time.Time `json:"last_login_at"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
|
||||
EnterpriseInfo *EnterpriseInfoItem `json:"enterprise_info,omitempty"`
|
||||
|
||||
// 钱包信息
|
||||
WalletBalance string `json:"wallet_balance,omitempty"`
|
||||
WalletBalance string `json:"wallet_balance,omitempty"`
|
||||
}
|
||||
|
||||
// EnterpriseInfoItem 企业信息项
|
||||
|
||||
@@ -43,8 +43,12 @@ type UserProfileResponse struct {
|
||||
Phone string `json:"phone" example:"13800138000"`
|
||||
Username string `json:"username,omitempty" example:"admin"`
|
||||
UserType string `json:"user_type" example:"user"`
|
||||
IsActive bool `json:"is_active" example:"true"`
|
||||
LastLoginAt *time.Time `json:"last_login_at,omitempty" example:"2024-01-01T00:00:00Z"`
|
||||
IsActive bool `json:"is_active" example:"true"`
|
||||
IsBlacklisted bool `json:"is_blacklisted" example:"false"`
|
||||
BlacklistReason string `json:"blacklist_reason,omitempty"`
|
||||
BlacklistSource string `json:"blacklist_source,omitempty"`
|
||||
BlacklistedAt *time.Time `json:"blacklisted_at,omitempty"`
|
||||
LastLoginAt *time.Time `json:"last_login_at,omitempty" example:"2024-01-01T00:00:00Z"`
|
||||
LoginCount int `json:"login_count" example:"10"`
|
||||
Permissions []string `json:"permissions,omitempty" example:"['user:read','user:write']"`
|
||||
EnterpriseInfo *EnterpriseInfoResponse `json:"enterprise_info,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user