lists($where, $page, $rows); // 获取资金类型名称映射 $fundNames = AccountService::getFundsDesc(); // 获取操作类型名称映射 $operateTypeNames = [ 1 => '充值', 2 => '提现', 3 => '转账', 4 => '系统操作', 5 => '管理员操作', 6 => '交易', 7 => '流转', ]; // 将模型转换为DTO $items = $paginator->getCollection()->map(function ($model) use ($fundNames, $operateTypeNames) { return FundLogDto::fromModel($model, $fundNames, $operateTypeNames); }); // 创建新的分页器,使用DTO集合 return new LengthAwarePaginator( $items, $paginator->total(), $paginator->perPage(), $paginator->currentPage(), ['path' => request()->url(), 'query' => request()->query()] ); } /** * 统计资金日志 * * @param array $where 查询条件 * @return array 统计结果 */ public function statistical(array $where) { $log = new Log(); $result = $log->statistical($where); return $result; } }