76 lines
2.7 KiB
Go
76 lines
2.7 KiB
Go
|
|
package v1
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
"github.com/gogf/gf/v2/frame/g"
|
|||
|
|
|
|||
|
|
userv1 "tool-api/api/user/v1"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// ============================================================================
|
|||
|
|
// 管理端「用户详情抽屉」聚合契约(A-new1):GET /user/detail
|
|||
|
|
//
|
|||
|
|
// 一次拉全:基础信息 / 额度 / 订单 / 笔记(仅标题·时间·提醒态) / 等级变更 / 优惠券。
|
|||
|
|
// 复用用户端已定义的 QuotaToolOut 与 UserCouponItem(跨包 import,无循环依赖)。
|
|||
|
|
// ============================================================================
|
|||
|
|
|
|||
|
|
// UserDetailBase 用户基础信息
|
|||
|
|
type UserDetailBase struct {
|
|||
|
|
Id int64 `json:"id"`
|
|||
|
|
Nickname string `json:"nickname"`
|
|||
|
|
AvatarUrl string `json:"avatar_url"`
|
|||
|
|
Openid string `json:"openid"`
|
|||
|
|
LevelKey string `json:"level_key"`
|
|||
|
|
LevelName string `json:"level_name"`
|
|||
|
|
LevelExpireAt string `json:"level_expire_at"` // 空 = 永久
|
|||
|
|
Status int `json:"status"`
|
|||
|
|
UsageCount int64 `json:"usage_count"`
|
|||
|
|
CreatedAt string `json:"created_at"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// OrderBrief 订单摘要(含优惠凭证字段)
|
|||
|
|
type OrderBrief struct {
|
|||
|
|
OutTradeNo string `json:"out_trade_no"`
|
|||
|
|
Title string `json:"title"`
|
|||
|
|
OrderType int `json:"order_type"`
|
|||
|
|
OriginPriceCents int64 `json:"origin_price_cents"`
|
|||
|
|
PaidPriceCents int64 `json:"paid_price_cents"`
|
|||
|
|
DiscountCents int64 `json:"discount_cents"`
|
|||
|
|
PromoKind int `json:"promo_kind"`
|
|||
|
|
Status int `json:"status"`
|
|||
|
|
StatusText string `json:"status_text"`
|
|||
|
|
CreatedAt string `json:"created_at"`
|
|||
|
|
DeliveredAt string `json:"delivered_at"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// NoteBrief 笔记摘要(**不含正文**)
|
|||
|
|
type NoteBrief struct {
|
|||
|
|
Id int64 `json:"id"`
|
|||
|
|
Title string `json:"title"`
|
|||
|
|
RemindStatus int `json:"remind_status"`
|
|||
|
|
RemindAt string `json:"remind_at"`
|
|||
|
|
CreatedAt string `json:"created_at"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// LevelLogItem 等级变更记录(取自操作审计)
|
|||
|
|
type LevelLogItem struct {
|
|||
|
|
At string `json:"at"`
|
|||
|
|
BeforeLevel string `json:"before_level"`
|
|||
|
|
AfterLevel string `json:"after_level"`
|
|||
|
|
Operator string `json:"operator"`
|
|||
|
|
Remark string `json:"remark"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// UserDetailReq 用户详情聚合
|
|||
|
|
type UserDetailReq struct {
|
|||
|
|
g.Meta `path:"/user/detail" method:"get" tags:"admin" summary:"用户详情(额度/订单/笔记/等级变更/券)"`
|
|||
|
|
UserId int64 `v:"required" json:"userId"`
|
|||
|
|
}
|
|||
|
|
type UserDetailRes struct {
|
|||
|
|
User UserDetailBase `json:"user"`
|
|||
|
|
Quotas []userv1.QuotaToolOut `json:"quotas"`
|
|||
|
|
Orders []OrderBrief `json:"orders"`
|
|||
|
|
Notes []NoteBrief `json:"notes"`
|
|||
|
|
LevelLogs []LevelLogItem `json:"level_logs"`
|
|||
|
|
Coupons []userv1.UserCouponItem `json:"coupons"`
|
|||
|
|
}
|