feat: add TenantLedger model and query generation
- Introduced TenantLedger model with fields for managing tenant transactions, including ID, TenantID, UserID, OrderID, transaction Type, Amount, and balance details. - Implemented CRUD operations for TenantLedger with methods for Create, Update, Delete, and Reload. - Generated query methods for TenantLedger to facilitate database interactions, including filtering, pagination, and aggregation functions. - Established relationships with Order model for foreign key references.
This commit is contained in:
36
backend/app/http/tenant/dto/order_admin.go
Normal file
36
backend/app/http/tenant/dto/order_admin.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"quyun/v2/app/requests"
|
||||
"quyun/v2/database/models"
|
||||
"quyun/v2/pkg/consts"
|
||||
)
|
||||
|
||||
// AdminOrderListFilter defines query filters for tenant-admin order listing.
|
||||
type AdminOrderListFilter struct {
|
||||
// Pagination controls paging parameters (page/limit).
|
||||
requests.Pagination `json:",inline" query:",inline"`
|
||||
// UserID filters orders by buyer user id.
|
||||
UserID *int64 `json:"user_id,omitempty" query:"user_id"`
|
||||
// Status filters orders by order status.
|
||||
Status *consts.OrderStatus `json:"status,omitempty" query:"status"`
|
||||
}
|
||||
|
||||
// AdminOrderRefundForm defines payload for tenant-admin to refund an order.
|
||||
type AdminOrderRefundForm struct {
|
||||
// Force indicates bypassing the default refund window check (paid_at + 24h).
|
||||
// 强制退款:true 表示绕过默认退款时间窗限制(需审计)。
|
||||
Force bool `json:"force,omitempty"`
|
||||
// Reason is the human-readable refund reason used for audit.
|
||||
// 退款原因:建议必填(由业务侧校验);用于审计与追责。
|
||||
Reason string `json:"reason,omitempty"`
|
||||
// IdempotencyKey ensures refund request is processed at most once.
|
||||
// 幂等键:同一笔退款重复请求时返回一致结果,避免重复退款/重复回滚。
|
||||
IdempotencyKey string `json:"idempotency_key,omitempty"`
|
||||
}
|
||||
|
||||
// AdminOrderDetail returns a tenant-admin order detail payload.
|
||||
type AdminOrderDetail struct {
|
||||
// Order is the order with items preloaded.
|
||||
Order *models.Order `json:"order,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user