feat(admin): 用户管理新增用户明细抽屉,聚合资金与交易全链路数据
- 用户管理操作列新增「明细」入口,抽屉按权限提供 5 个 Tab:钱包流水、订单记录、提现记录、邀请返利、支付记录 - 后端:后台订单列表新增 user_id 精确过滤(owner_id / renter_id),邀请关系与返利流水新增 inviter_id / invitee_id 过滤 - 修复:返利流水的「被邀请人手机号」筛选此前后端未实现,一直无效 - 资金流水页、支付记录页支持 ?user_id= 预填,可从明细直达 - 顺带将 invitation/dto.go、repository.go 中两处既有缩进错位按 gofmt 规整
This commit is contained in:
@@ -572,18 +572,18 @@ func (r *Repository) GetUserSummary(ctx context.Context, userID uint64, siteID u
|
||||
Select("COALESCE(SUM(rebate_amount_cent), 0)").Scan(¤tMonthEstCent).Error
|
||||
|
||||
return &UserInvitationSummaryDTO{
|
||||
HasInviteCode: hasCode,
|
||||
InviteCode: code,
|
||||
InviteLink: fmt.Sprintf("/i/%s", code),
|
||||
IsRealnameVerified: user.RealnameStatus == "verified",
|
||||
TotalInvitedCount: totalCount,
|
||||
ActiveInvitedCount: activeCount,
|
||||
PendingInvitedCount: pendingCount,
|
||||
TotalRebateCent: totalRebateCent,
|
||||
CurrentMonthEstCent: currentMonthEstCent,
|
||||
FirstMonthRate: firstRate,
|
||||
SecondMonthRate: secondRate,
|
||||
SubsequentRate: subsequentRate,
|
||||
HasInviteCode: hasCode,
|
||||
InviteCode: code,
|
||||
InviteLink: fmt.Sprintf("/i/%s", code),
|
||||
IsRealnameVerified: user.RealnameStatus == "verified",
|
||||
TotalInvitedCount: totalCount,
|
||||
ActiveInvitedCount: activeCount,
|
||||
PendingInvitedCount: pendingCount,
|
||||
TotalRebateCent: totalRebateCent,
|
||||
CurrentMonthEstCent: currentMonthEstCent,
|
||||
FirstMonthRate: firstRate,
|
||||
SecondMonthRate: secondRate,
|
||||
SubsequentRate: subsequentRate,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -734,6 +734,12 @@ func (r *Repository) ListAdminInvitations(ctx context.Context, query AdminInvita
|
||||
if query.DistributionSiteID != nil {
|
||||
db = db.Where("ui.distribution_site_id = ?", *query.DistributionSiteID)
|
||||
}
|
||||
if query.InviterID > 0 {
|
||||
db = db.Where("ui.inviter_id = ?", query.InviterID)
|
||||
}
|
||||
if query.InviteeID > 0 {
|
||||
db = db.Where("ui.invitee_id = ?", query.InviteeID)
|
||||
}
|
||||
|
||||
var total int64
|
||||
if err := db.Count(&total).Error; err != nil {
|
||||
@@ -804,12 +810,21 @@ func (r *Repository) ListAdminRebateLedgers(ctx context.Context, query AdminReba
|
||||
if p := strings.TrimSpace(query.InviterPhone); p != "" {
|
||||
db = db.Where("inviter.phone = ?", p)
|
||||
}
|
||||
if p := strings.TrimSpace(query.InviteePhone); p != "" {
|
||||
db = db.Where("invitee.phone = ?", p)
|
||||
}
|
||||
if t := strings.TrimSpace(query.TradeRole); t != "" {
|
||||
db = db.Where("irl.trade_role = ?", t)
|
||||
}
|
||||
if query.DistributionSiteID != nil {
|
||||
db = db.Where("irl.distribution_site_id = ?", *query.DistributionSiteID)
|
||||
}
|
||||
if query.InviterID > 0 {
|
||||
db = db.Where("irl.inviter_id = ?", query.InviterID)
|
||||
}
|
||||
if query.InviteeID > 0 {
|
||||
db = db.Where("irl.invitee_id = ?", query.InviteeID)
|
||||
}
|
||||
|
||||
var total int64
|
||||
if err := db.Count(&total).Error; err != nil {
|
||||
|
||||
Reference in New Issue
Block a user