import { Controller, Get, Param, Query } from '@nestjs/common'; import { ApiTags, ApiOperation, ApiBearerAuth, ApiParam, ApiQuery } from '@nestjs/swagger'; import { SystemAccountsService } from '../../application/services/system-accounts.service'; @ApiTags('System Accounts') @ApiBearerAuth() @Controller('system-accounts') export class SystemAccountsController { constructor(private readonly systemAccountsService: SystemAccountsService) {} @Get() @ApiOperation({ summary: '获取系统账户列表' }) async getSystemAccounts() { return this.systemAccountsService.getSystemAccounts(); } @Get('summary') @ApiOperation({ summary: '获取系统账户汇总' }) async getSystemAccountsSummary() { return this.systemAccountsService.getSystemAccountsSummary(); } @Get(':accountType/records') @ApiOperation({ summary: '获取系统账户挖矿记录' }) @ApiParam({ name: 'accountType', type: String, description: '系统账户类型' }) @ApiQuery({ name: 'page', required: false, type: Number }) @ApiQuery({ name: 'pageSize', required: false, type: Number }) async getSystemAccountMiningRecords( @Param('accountType') accountType: string, @Query('page') page?: number, @Query('pageSize') pageSize?: number, ) { return this.systemAccountsService.getSystemAccountMiningRecords( accountType, page ?? 1, pageSize ?? 20, ); } @Get(':accountType/transactions') @ApiOperation({ summary: '获取系统账户交易记录' }) @ApiParam({ name: 'accountType', type: String, description: '系统账户类型' }) @ApiQuery({ name: 'page', required: false, type: Number }) @ApiQuery({ name: 'pageSize', required: false, type: Number }) async getSystemAccountTransactions( @Param('accountType') accountType: string, @Query('page') page?: number, @Query('pageSize') pageSize?: number, ) { return this.systemAccountsService.getSystemAccountTransactions( accountType, page ?? 1, pageSize ?? 20, ); } }