242 lines
8.5 KiB
Go
242 lines
8.5 KiB
Go
package dto
|
|
|
|
import (
|
|
v1_dto "quyun/v2/app/http/v1/dto"
|
|
"quyun/v2/app/requests"
|
|
"quyun/v2/pkg/consts"
|
|
)
|
|
|
|
// Filters
|
|
type UserListFilter struct {
|
|
requests.Pagination
|
|
Username *string `query:"username"`
|
|
}
|
|
|
|
type TenantListFilter struct {
|
|
requests.Pagination
|
|
Name *string `query:"name"`
|
|
}
|
|
|
|
type SuperContentListFilter struct {
|
|
requests.Pagination
|
|
// Add filters if needed, currently list signature is just pagination in super.go service
|
|
}
|
|
|
|
type SuperOrderListFilter struct {
|
|
requests.Pagination
|
|
// Add filters if needed
|
|
}
|
|
|
|
// SuperUserLite 用于平台用户列表的轻量级用户信息
|
|
type SuperUserLite struct {
|
|
ID int64 `json:"id"`
|
|
Username string `json:"username"`
|
|
Roles []consts.Role `json:"roles"`
|
|
Status consts.UserStatus `json:"status"`
|
|
StatusDescription string `json:"status_description"`
|
|
VerifiedAt string `json:"verified_at"`
|
|
CreatedAt string `json:"created_at"`
|
|
UpdatedAt string `json:"updated_at"`
|
|
}
|
|
|
|
type UserItem struct {
|
|
SuperUserLite
|
|
Balance int64 `json:"balance"`
|
|
BalanceFrozen int64 `json:"balance_frozen"`
|
|
OwnedTenantCount int64 `json:"owned_tenant_count"`
|
|
JoinedTenantCount int64 `json:"joined_tenant_count"`
|
|
}
|
|
|
|
type UserStatistics struct {
|
|
Status consts.UserStatus `json:"status"`
|
|
StatusDescription string `json:"status_description"`
|
|
Count int64 `json:"count"`
|
|
}
|
|
|
|
type UserStatusUpdateForm struct {
|
|
Status consts.UserStatus `json:"status" validate:"required"`
|
|
}
|
|
|
|
type UserRolesUpdateForm struct {
|
|
Roles []consts.Role `json:"roles" validate:"required,min=1"`
|
|
}
|
|
|
|
type UserTenantItem struct {
|
|
TenantID int64 `json:"tenant_id"`
|
|
TenantStatus consts.TenantStatus `json:"tenant_status"`
|
|
TenantStatusDescription string `json:"tenant_status_description"`
|
|
Name string `json:"name"`
|
|
Code string `json:"code"`
|
|
Owner *TenantOwnerUserLite `json:"owner"`
|
|
Role []consts.TenantUserRole `json:"role"`
|
|
MemberStatus consts.UserStatus `json:"member_status"`
|
|
MemberStatusDescription string `json:"member_status_description"`
|
|
JoinedAt string `json:"joined_at"`
|
|
ExpiredAt string `json:"expired_at"`
|
|
}
|
|
|
|
// Tenant Related
|
|
type TenantCreateForm struct {
|
|
Name string `json:"name" validate:"required,max=128"`
|
|
Code string `json:"code" validate:"required,max=64"`
|
|
AdminUserID int64 `json:"admin_user_id" validate:"required"`
|
|
Duration int `json:"duration" validate:"required,oneof=7 30 90 180 365"`
|
|
}
|
|
|
|
type TenantItem struct {
|
|
ID int64 `json:"id"`
|
|
UUID string `json:"uuid"`
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
Status consts.TenantStatus `json:"status"`
|
|
StatusDescription string `json:"status_description"`
|
|
Config []int `json:"config"` // Replace with actual config struct if needed
|
|
Owner *TenantOwnerUserLite `json:"owner"`
|
|
AdminUsers []*TenantAdminUserLite `json:"admin_users"`
|
|
UserCount int64 `json:"user_count"`
|
|
IncomeAmountPaidSum int64 `json:"income_amount_paid_sum"`
|
|
ExpiredAt string `json:"expired_at"`
|
|
CreatedAt string `json:"created_at"`
|
|
UpdatedAt string `json:"updated_at"`
|
|
UserID int64 `json:"user_id"`
|
|
Users []*SuperUserLite `json:"users"`
|
|
}
|
|
|
|
type TenantOwnerUserLite struct {
|
|
ID int64 `json:"id"`
|
|
Username string `json:"username"`
|
|
}
|
|
|
|
type TenantAdminUserLite struct {
|
|
ID int64 `json:"id"`
|
|
Username string `json:"username"`
|
|
}
|
|
|
|
type TenantExpireUpdateForm struct {
|
|
Duration int `json:"duration" validate:"required,oneof=7 30 90 180 365"`
|
|
}
|
|
|
|
type TenantStatusUpdateForm struct {
|
|
Status consts.TenantStatus `json:"status" validate:"required"`
|
|
}
|
|
|
|
type SuperTenantContentItem struct {
|
|
Content *v1_dto.ContentItem `json:"content"`
|
|
StatusDescription string `json:"status_description"`
|
|
VisibilityDescription string `json:"visibility_description"`
|
|
Tenant *SuperContentTenantLite `json:"tenant"`
|
|
Owner *SuperUserLite `json:"owner"`
|
|
Price *v1_dto.ContentPrice `json:"price"`
|
|
}
|
|
|
|
type SuperContentTenantLite struct {
|
|
ID int64 `json:"id"`
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
type SuperTenantContentStatusUpdateForm struct {
|
|
Status consts.ContentStatus `json:"status" validate:"required,oneof=unpublished blocked"`
|
|
}
|
|
|
|
type SuperTenantUserItem struct {
|
|
User *SuperUserLite `json:"user"`
|
|
TenantUser *TenantUser `json:"tenant_user"`
|
|
}
|
|
|
|
type TenantUser struct {
|
|
ID int64 `json:"id"`
|
|
TenantID int64 `json:"tenant_id"`
|
|
UserID int64 `json:"user_id"`
|
|
Role []consts.TenantUserRole `json:"role"`
|
|
Status consts.UserStatus `json:"status"`
|
|
CreatedAt string `json:"created_at"`
|
|
UpdatedAt string `json:"updated_at"`
|
|
}
|
|
|
|
// Order Related
|
|
type SuperOrderItem struct {
|
|
ID int64 `json:"id"`
|
|
Type consts.OrderType `json:"type"`
|
|
Status consts.OrderStatus `json:"status"`
|
|
StatusDescription string `json:"status_description"`
|
|
Currency consts.Currency `json:"currency"`
|
|
AmountOriginal int64 `json:"amount_original"`
|
|
AmountDiscount int64 `json:"amount_discount"`
|
|
AmountPaid int64 `json:"amount_paid"`
|
|
Tenant *OrderTenantLite `json:"tenant"`
|
|
Buyer *OrderBuyerLite `json:"buyer"`
|
|
// Snapshot 订单快照,包含下单时的关键参数与定价信息,便于审计回溯。
|
|
Snapshot any `json:"snapshot"`
|
|
// Items 订单明细行,用于展示具体内容与金额拆分。
|
|
Items []SuperOrderItemLine `json:"items"`
|
|
PaidAt string `json:"paid_at"`
|
|
RefundedAt string `json:"refunded_at"`
|
|
CreatedAt string `json:"created_at"`
|
|
UpdatedAt string `json:"updated_at"`
|
|
}
|
|
|
|
type OrderTenantLite struct {
|
|
ID int64 `json:"id"`
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
type OrderBuyerLite struct {
|
|
ID int64 `json:"id"`
|
|
Username string `json:"username"`
|
|
}
|
|
|
|
// SuperOrderItemLine 表示订单明细行。
|
|
type SuperOrderItemLine struct {
|
|
// ID 订单明细ID。
|
|
ID int64 `json:"id"`
|
|
// ContentID 购买的内容ID。
|
|
ContentID int64 `json:"content_id"`
|
|
// AmountPaid 该明细实付金额(分)。
|
|
AmountPaid int64 `json:"amount_paid"`
|
|
// Snapshot 明细快照,用于展示内容标题等历史信息。
|
|
Snapshot any `json:"snapshot"`
|
|
}
|
|
|
|
type OrderStatisticsResponse struct {
|
|
TotalCount int64 `json:"total_count"`
|
|
TotalAmountPaidSum int64 `json:"total_amount_paid_sum"`
|
|
ByStatus []OrderStatisticsRow `json:"by_status"`
|
|
}
|
|
|
|
type OrderStatisticsRow struct {
|
|
Status consts.OrderStatus `json:"status"`
|
|
StatusDescription string `json:"status_description"`
|
|
Count int64 `json:"count"`
|
|
AmountPaidSum int64 `json:"amount_paid_sum"`
|
|
}
|
|
|
|
type SuperOrderDetail struct {
|
|
Order *SuperOrderItem `json:"order"` // Using SuperOrderItem as base, extend if needed
|
|
Tenant *OrderTenantLite `json:"tenant"`
|
|
Buyer *OrderBuyerLite `json:"buyer"`
|
|
}
|
|
|
|
type SuperOrderRefundForm struct {
|
|
Force bool `json:"force"`
|
|
Reason string `json:"reason"`
|
|
IdempotencyKey string `json:"idempotency_key"`
|
|
}
|
|
|
|
// AdminContentItem for super admin view
|
|
type AdminContentItem struct {
|
|
Content *v1_dto.ContentItem `json:"content"`
|
|
Owner *AdminContentOwnerLite `json:"owner"`
|
|
Price *v1_dto.ContentPrice `json:"price"`
|
|
StatusDescription string `json:"status_description"`
|
|
VisibilityDescription string `json:"visibility_description"`
|
|
}
|
|
|
|
type AdminContentOwnerLite struct {
|
|
ID int64 `json:"id"`
|
|
Username string `json:"username"`
|
|
Roles []consts.Role `json:"roles"`
|
|
Status consts.UserStatus `json:"status"`
|
|
}
|