统一金额分制重构

This commit is contained in:
yml
2026-06-09 19:04:11 +08:00
parent 87673288ef
commit 5cd3ead4bd
69 changed files with 886 additions and 1277 deletions
@@ -44,9 +44,9 @@ func (r *Repository) Summary() (*DashboardDTO, error) {
return nil, err
}
if err := r.db.Model(&model.WalletLedger{}).
Select("COALESCE(SUM(amount), 0)").
Select("COALESCE(SUM(amount_cent), 0)").
Where("created_at >= ?", today).
Scan(&metrics.TodayLedgerAmount).Error; err != nil {
Scan(&metrics.TodayLedgerAmountCent).Error; err != nil {
return nil, err
}
if err := r.db.Model(&model.RentalListing{}).Where("review_status = ?", "pending").Count(&pending.ListingReviews).Error; err != nil {
@@ -81,7 +81,7 @@ func (r *Repository) Summary() (*DashboardDTO, error) {
func (r *Repository) recentOrders() ([]RecentOrderDTO, error) {
rows := make([]RecentOrderDTO, 0)
err := r.db.Table("rental_orders AS o").
Select("o.id, o.order_no, a.title, o.renter_id, o.owner_id, o.status, o.rent_amount, o.deposit_amount, o.created_at").
Select("o.id, o.order_no, a.title, o.renter_id, o.owner_id, o.status, o.rent_amount_cent, o.deposit_amount_cent, o.created_at").
Joins("JOIN game_accounts AS a ON a.id = o.account_id").
Order("o.id DESC").
Limit(8).