优化客服群聊订单信息展示
This commit is contained in:
@@ -80,6 +80,22 @@ func (r *Repository) FindAdmin(ctx context.Context, orderID uint64) (*OrderDTO,
|
||||
return &dto, nil
|
||||
}
|
||||
|
||||
func (r *Repository) FindLatestAdminByListing(ctx context.Context, listingID uint64) (*OrderDTO, error) {
|
||||
var row orderRow
|
||||
db := r.db.WithContext(ctx)
|
||||
if err := r.adminQuery(ctx).
|
||||
Where("o.listing_id = ?", listingID).
|
||||
Order("o.id DESC").
|
||||
First(&row).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dto := row.toAdminDTO()
|
||||
applyPaymentDeadline(&dto, row.RentalOrder, pendingPaymentTimeoutMinutes(db))
|
||||
dto.ActiveDispute = r.activeDisputeDTO(ctx, row.ID)
|
||||
dto.Checkout = r.latestCheckoutAdminDTO(ctx, row.ID)
|
||||
return &dto, nil
|
||||
}
|
||||
|
||||
func (r *Repository) FindForUser(ctx context.Context, userID uint64, orderID uint64) (*OrderDTO, error) {
|
||||
var row orderRow
|
||||
db := r.db.WithContext(ctx)
|
||||
|
||||
Reference in New Issue
Block a user