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

92 lines
4.3 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package dto
// UserListRequest 用户列表请求。
type UserListRequest struct {
PageRequest
Keyword string `form:"keyword"` // 模糊匹配昵称/手机号/OpenID
Status int8 `form:"status" binding:"omitempty,oneof=1 2 3 4"` // 1=正常 2=临时禁用 3=永久禁用 4=已注销
}
// UserListItem 用户列表项。
type UserListItem struct {
ID int64 `json:"id"`
UserUUID string `json:"user_uuid"`
Username string `json:"username"`
Avatar string `json:"avatar"`
Sex int8 `json:"sex"`
Phone string `json:"phone"`
Status int8 `json:"status"` // 1=正常 2=临时禁用 3=永久禁用 4=已注销
BanReason string `json:"ban_reason"`
BanStart int64 `json:"ban_start"`
BanExpire int64 `json:"ban_expire"`
VIPType int8 `json:"vip_type"` // 1=非会员 2=月度会员 3=年度会员 4=体验会员
VIPExpire int64 `json:"vip_expire"` // VIP 到期时间(秒),已过期时归一为 0
LastLoginTime int64 `json:"last_login_time"`
CreatedAt int64 `json:"created_at"`
}
// UserListResponse 用户列表响应。
type UserListResponse struct {
PageResponse
List []UserListItem `json:"list"`
}
// QuotaItem 用户某类额度。
// Cos(quota_type=1):Total=永久总额度、Used=永久累计已用、Remain=永久剩余;
// AI/社区/衣柜(2/3/4):Total=每日总额度、Used=当日已用、Remain=当日剩余(次日 0 点重置)。
type QuotaItem struct {
QuotaType int8 `json:"quota_type"` // 1=上传 2=AI 3=社区分享 4=衣柜分享
Total int64 `json:"total"` // 总额度(Cos 永久 / 每日额度)
Used int64 `json:"used"` // 已用(Cos 永久累计 / 当日已用)
Remain int64 `json:"remain"` // 剩余
}
// UserGrantItem 用户额度凭证(有有效期赠送额度)。
type UserGrantItem struct {
ID int64 `json:"id"`
QuotaType int8 `json:"quota_type"` // 1=上传 2=AI 3=社区分享 4=衣柜分享
Amount int64 `json:"amount"` // 赠送总量(Cos=一次性库存;AI/社区/衣柜=有效期内每日加量)
Used int64 `json:"used"` // 已用量(仅 Cos 扣减)
Source int8 `json:"source"` // 1=会员包 2=加量包 3=广告激励 4=体验会员赠送
ExpireTime int64 `json:"expire_time"` // 到期时间(秒,0=跟随 VIP)
RefID string `json:"ref_id"` // 关联ID(订单号/广告记录ID/人工发放标识)
CreatedAt int64 `json:"created_at"`
}
// UserDetailResponse 用户详情响应。
type UserDetailResponse struct {
UserListItem
Quotas []QuotaItem `json:"quotas"`
Grants []UserGrantItem `json:"grants"`
}
// UserBanRequest 封禁用户请求。
type UserBanRequest struct {
BanType int8 `json:"ban_type" binding:"required,oneof=1 2"` // 1=临时禁用 2=永久禁用
BanDays int `json:"ban_days" binding:"omitempty,min=1,max=3650"` // 临时禁用天数(ban_type=1 时必填)
Reason string `json:"reason" binding:"required,max=200"`
}
// UserUnbanRequest 解封用户请求。
type UserUnbanRequest struct {
Reason string `json:"reason" binding:"omitempty,max=200"`
}
// UserQuotaAdjustRequest 额度发放请求(发放有有效期额度凭证)。
// Cos(quota_type=1):Amount 为一次性库存,ExpireDays 天内有效;
// AI/社区/衣柜(2/3/4):Amount 为有效期内每天额外赠送次数,ExpireDays 天内有效。
type UserQuotaAdjustRequest struct {
QuotaType int8 `json:"quota_type" binding:"required,oneof=1 2 3 4"` // 1=上传 2=AI 3=社区分享 4=衣柜分享
Amount int64 `json:"amount" binding:"required,min=1,max=100000000"` // 发放数量
ExpireDays int64 `json:"expire_days" binding:"required,min=1,max=3650"` // 有效期天数
}
// UserVIPAdjustRequest VIP 人工调整请求。
// 叠加语义(与购买发放一致):vip_expire = max(当前到期, now) + vip_days*86400。
// vip_days=0 表示取消会员(vip_type 归 1、到期清零)。
type UserVIPAdjustRequest struct {
VIPType int8 `json:"vip_type" binding:"required,oneof=1 2 3 4"` // 1=非会员 2=月度会员 3=年度会员 4=体验会员
VIPDays int64 `json:"vip_days" binding:"omitempty,min=0,max=3650"`
Reason string `json:"reason" binding:"required,max=200"`
}