Files
zhengchiliu 0863234bc5 feat(backend): 对齐业务服务额度与内容治理口径
仪表盘待办与穿搭概况改为公开/私密/已封禁口径,移除恒为零的待审核统计;补齐额度凭证来源 source=4 与流水 change_type=7 枚举及订单商品类型、额度有效期快照字段;管理员发放与回收额度凭证在同一事务内写入人工调整流水,回收流水使用独立 order_no 避免撞唯一索引,并增加凭证归属校验;对齐 Quota 配置免费额度值,同步更新 README 与配置说明。
2026-09-16 02:58:56 +08:00

149 lines
5.2 KiB
Go

package dto
// DashboardResponse 仪表盘统计响应。
type DashboardResponse struct {
Users DashboardUsers `json:"users"`
Orders DashboardOrders `json:"orders"`
Revenue DashboardRevenue `json:"revenue"`
Todo DashboardTodo `json:"todo"`
Content DashboardContent `json:"content"`
VIP DashboardVIP `json:"vip"`
Goods DashboardGoods `json:"goods"`
Usage DashboardUsage `json:"usage"`
Social DashboardSocial `json:"social"`
}
// DashboardUsers 用户统计。
type DashboardUsers struct {
Total int64 `json:"total"` // 用户总数
TodayNew int64 `json:"today_new"` // 今日新增
Normal int64 `json:"normal"` // 正常
TempBan int64 `json:"temp_ban"` // 临时禁用
PermBan int64 `json:"perm_ban"` // 永久禁用
Deactivated int64 `json:"deactivated"` // 已注销
}
// DashboardOrders 订单统计。
type DashboardOrders struct {
Total int64 `json:"total"` // 订单总数
Pending int64 `json:"pending"` // 待支付
Paid int64 `json:"paid"` // 已支付
Cancelled int64 `json:"cancelled"` // 已取消
Expired int64 `json:"expired"` // 已过期
Refunded int64 `json:"refunded"` // 已退款
}
// DashboardRevenue 营收统计(单位:分)。
type DashboardRevenue struct {
TotalRevenue int64 `json:"total_revenue"` // 累计营收
TodayRevenue int64 `json:"today_revenue"` // 今日营收
RefundTotal int64 `json:"refund_total"` // 累计退款
}
// DashboardTodo 待办与核心概览。
type DashboardTodo struct {
RefundPending int64 `json:"refund_pending"` // 待处理退款
OutfitPublicTotal int64 `json:"outfit_public_total"` // 公开展示中的穿搭数(不含已封禁)
OutfitBanned int64 `json:"outfit_banned"` // 已封禁穿搭
GoodsOnShelf int64 `json:"goods_on_shelf"` // 上架商品数
}
// ===== 内容审核概况 =====
// DashboardContent 内容审核概况。
type DashboardContent struct {
Outfit DashboardOutfitStats `json:"outfit"`
Clothes DashboardClothesStats `json:"clothes"`
Share DashboardShareStats `json:"share"`
}
// DashboardOutfitStats 穿搭内容概况。
// 业务侧用户公开穿搭时即自动过审,审核不再是公开的前置条件,故不再输出审核状态分布;
// 公开/私密按 is_public 统计且均已剔除已封禁,三者在图表中互不重叠。
type DashboardOutfitStats struct {
Total int64 `json:"total"` // 穿搭总数
Public int64 `json:"public"` // 公开展示中(不含已封禁)
Private int64 `json:"private"` // 私密(不含已封禁)
Banned int64 `json:"banned"` // 已封禁
}
// DashboardClothesStats 衣物图片处理统计。
type DashboardClothesStats struct {
Total int64 `json:"total"` // 衣物总数
Processing int64 `json:"processing"` // 处理中(抠图/分类/排队)
Success int64 `json:"success"` // 处理成功
Failed int64 `json:"failed"` // 处理失败
}
// DashboardShareStats 衣柜分享统计。
type DashboardShareStats struct {
Total int64 `json:"total"` // 分享总数
Normal int64 `json:"normal"` // 正常
Cancelled int64 `json:"cancelled"` // 用户取消
Expired int64 `json:"expired"` // 已过期
Banned int64 `json:"banned"` // 管理员封禁
}
// ===== VIP 会员概况 =====
// DashboardVIP 会员概况。
type DashboardVIP struct {
MemberTotal int64 `json:"member_total"` // 有效会员总数(月度/年度/体验)
Monthly int64 `json:"monthly"` // 月度会员
Yearly int64 `json:"yearly"` // 年度会员
Trial int64 `json:"trial"` // 体验会员
ExpiringSoon int64 `json:"expiring_soon"` // 7天内即将到期
}
// ===== 商品分类统计 =====
// DashboardGoods 商品统计。
type DashboardGoods struct {
Total int64 `json:"total"`
OnShelf int64 `json:"on_shelf"`
OffShelf int64 `json:"off_shelf"`
ByType []GoodsTypeCount `json:"by_type"`
}
// GoodsTypeCount 商品类型数量。
type GoodsTypeCount struct {
Type int8 `json:"type"` // 1会员包 2上传包 3AI推荐包 4衣柜分享包 5搭配分享包
Count int64 `json:"count"`
}
// ===== 趋势 =====
// TrendRequest 趋势查询参数。
type TrendRequest struct {
Days int `form:"days" binding:"omitempty,min=1,max=90"`
}
// TrendResponse 趋势响应。
type TrendResponse struct {
Points []TrendPoint `json:"points"`
}
// TrendPoint 单日趋势点。
type TrendPoint struct {
Date string `json:"date"` // YYYY-MM-DD
NewUsers int64 `json:"new_users"` // 新增用户
Orders int64 `json:"orders"` // 已支付订单量
Revenue int64 `json:"revenue"` // 营收(分)
}
// ===== 今日消耗与互动 =====
// DashboardUsage 今日消耗统计。
type DashboardUsage struct {
AIRecommend int64 `json:"ai_recommend"` // 今日AI推荐消耗次数
ClosetShare int64 `json:"closet_share"` // 今日衣柜分享消耗次数
OutfitShare int64 `json:"outfit_share"` // 今日社区分享消耗次数
}
// DashboardSocial 内容互动统计。
type DashboardSocial struct {
CosImageCount int64 `json:"cos_image_count"` // COS总图数
LikeCount int64 `json:"like_count"` // 点赞数
CollectCount int64 `json:"collect_count"` // 收藏数
}