package dto import ( "time" "quyun/v2/app/requests" "quyun/v2/database/models" "quyun/v2/pkg/consts" ) // AdminLedgerListFilter 定义“租户后台余额流水”查询条件。 // // 设计目标: // - 用于审计/对账:可以按操作者(operator_user_id)检索敏感操作流水; // - 也可以按用户、订单、类型、业务引用快速定位流水集合。 type AdminLedgerListFilter struct { // Pagination 分页参数(page/limit)。 requests.Pagination `json:",inline" query:",inline"` // OperatorUserID 按操作者用户ID过滤(可选)。 // 典型场景:后台检索“某个管理员发起的充值/退款”等敏感操作流水。 OperatorUserID *int64 `json:"operator_user_id,omitempty" query:"operator_user_id"` // UserID 按余额账户归属用户ID过滤(可选)。 // 典型场景:查看某个租户成员的资金变化全链路。 UserID *int64 `json:"user_id,omitempty" query:"user_id"` // Type 按流水类型过滤(可选)。 Type *consts.TenantLedgerType `json:"type,omitempty" query:"type"` // OrderID 按关联订单过滤(可选)。 OrderID *int64 `json:"order_id,omitempty" query:"order_id"` // BizRefType 按业务引用类型过滤(可选)。 // 约定:当前业务写入为 "order";未来可扩展为 refund/topup 等。 BizRefType *string `json:"biz_ref_type,omitempty" query:"biz_ref_type"` // BizRefID 按业务引用ID过滤(可选)。 BizRefID *int64 `json:"biz_ref_id,omitempty" query:"biz_ref_id"` // CreatedAtFrom 创建时间起(可选)。 CreatedAtFrom *time.Time `json:"created_at_from,omitempty" query:"created_at_from"` // CreatedAtTo 创建时间止(可选)。 CreatedAtTo *time.Time `json:"created_at_to,omitempty" query:"created_at_to"` } // AdminLedgerItem 返回一条余额流水(租户后台视角),并补充展示字段。 type AdminLedgerItem struct { // Ledger 流水记录(租户内隔离)。 Ledger *models.TenantLedger `json:"ledger"` // TypeDescription 流水类型中文说明(用于前端展示)。 TypeDescription string `json:"type_description"` }