Files
hfb_sys/backend/internal/modules/admindashboard/dto.go
T
yml2213 cca40940d5 feat(admin): 新增客服手动录单功能与仪表盘今日录单统计
- 做了什么:
  - 新增客服手动录单数据库迁移 000084 及对应模型,支持编号唯一校验、客服快照绑定与 CRUD 操作;
  - 后端提供 csmanualentry 业务模块及相关 API,并在仪表盘摘要中聚合今日各客服录单数量;
  - 前端增加客服手动录单视图页面、路由与侧边栏导航,支持录单二次确认与细粒度权限控制;
  - 管理后台仪表盘增加今日客服手动录单卡片展示。
- 为什么:
  - 满足客服在后台手动登记外部业务编号需求,并便于运营按客服统计今日录单业绩和追溯对账。
- 验证方式:
  - 执行后端全量测试 go test ./... 与静态检查 go vet ./... 全部通过;
  - 执行前端代码门禁 npm run check 与 vite build 全部通过;
  - 执行 goose down/up 迁移回滚与应用测试通过,角色权限分配正确;
  - 本地 dev 联调 POST /api/admin/manual-entries 录单成功返回 201。
2026-10-12 14:52:24 +08:00

96 lines
3.8 KiB
Go

package admindashboard
import "time"
type DashboardDTO struct {
Metrics MetricsDTO `json:"metrics"`
Pending PendingDTO `json:"pending"`
ListingDaily ListingDailyOverviewDTO `json:"listing_daily"`
ManualEntryToday []ManualEntryAgentStatsDTO `json:"manual_entry_today"`
RecentOrders []RecentOrderDTO `json:"recent_orders"`
RecentDisputes []RecentDisputeDTO `json:"recent_disputes"`
GeneratedAt time.Time `json:"generated_at"`
}
type MetricsDTO struct {
TotalUsers int64 `json:"total_users"`
VerifiedUsers int64 `json:"verified_users"`
TotalListings int64 `json:"total_listings"`
PublishedListings int64 `json:"published_listings"`
TotalOrders int64 `json:"total_orders"`
RentingOrders int64 `json:"renting_orders"`
TodayOrders int64 `json:"today_orders"`
TodayLedgerAmountCent int64 `json:"today_ledger_amount_cent"`
}
// ListingDailyOverviewDTO 商品上下架统计:今日三组 + 近 7 日趋势。
type ListingDailyOverviewDTO struct {
Today ListingDayStatsDTO `json:"today"`
Trend []ListingDayStatsDTO `json:"trend"`
TodayChannels []ListingChannelDayStatsDTO `json:"today_channels"`
ChannelTrend []ListingChannelDayStatsDTO `json:"channel_trend"`
TodayUploaders []ListingUploaderDayStatsDTO `json:"today_uploaders"`
UploaderTrend []ListingUploaderDayStatsDTO `json:"uploader_trend"`
Days int `json:"days"`
Timezone string `json:"timezone"`
}
type ListingDayStatsDTO struct {
Date string `json:"date"` // YYYY-MM-DD(上海时区)
PublishedCount int64 `json:"published_count"`
ActiveOfflineCount int64 `json:"active_offline_count"` // 号主 + 后台主动下架
TradeLeaveCount int64 `json:"trade_leave_count"` // rented / completed / sealed / 交易侧归档下架
}
type ListingChannelDayStatsDTO struct {
Date string `json:"date"` // YYYY-MM-DD(上海时区)
SourceChannel string `json:"source_channel"`
PublishedCount int64 `json:"published_count"`
ActiveOfflineCount int64 `json:"active_offline_count"`
TradeLeaveCount int64 `json:"trade_leave_count"`
}
type ListingUploaderDayStatsDTO struct {
Date string `json:"date"` // YYYY-MM-DD(上海时区)
UploaderID uint64 `json:"uploader_id"`
UploaderName string `json:"uploader_name"`
UploadCount int64 `json:"upload_count"`
}
// ManualEntryAgentStatsDTO 今日客服手动录单统计(按客服聚合)。
type ManualEntryAgentStatsDTO struct {
AdminID uint64 `json:"admin_id"`
AdminName string `json:"admin_name"`
Count int64 `json:"count"`
}
type PendingDTO struct {
ListingReviews int64 `json:"listing_reviews"`
Disputes int64 `json:"disputes"`
PendingHandoffs int64 `json:"pending_handoffs"`
PendingReturnConfirms int64 `json:"pending_return_confirms"`
}
type RecentOrderDTO struct {
ID uint64 `json:"id"`
OrderNo string `json:"order_no"`
Title string `json:"title"`
RenterID uint64 `json:"renter_id"`
OwnerID uint64 `json:"owner_id"`
Status string `json:"status"`
RentAmountCent int64 `json:"rent_amount_cent"`
DepositAmountCent int64 `json:"deposit_amount_cent"`
CreatedAt time.Time `json:"created_at"`
}
type RecentDisputeDTO struct {
ID uint64 `json:"id"`
OrderID uint64 `json:"order_id"`
OrderNo string `json:"order_no"`
Title string `json:"title"`
Type string `json:"type"`
Status string `json:"status"`
InitiatorID uint64 `json:"initiator_id"`
CreatedAt time.Time `json:"created_at"`
}