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, ); } @Get(':accountType/contributions') @ApiOperation({ summary: '获取系统账户算力来源明细', description: '显示该账户的每笔算力来自哪个认种订单,支持按省市细分的账户类型(如 CITY_440100, PROVINCE_440000)', }) @ApiParam({ name: 'accountType', type: String, description: '系统账户类型(组合键),如 OPERATION, PROVINCE_440000, CITY_440100', }) @ApiQuery({ name: 'page', required: false, type: Number, description: '页码,默认1' }) @ApiQuery({ name: 'pageSize', required: false, type: Number, description: '每页数量,默认20' }) async getSystemAccountContributionRecords( @Param('accountType') accountType: string, @Query('page') page?: number, @Query('pageSize') pageSize?: number, ) { return this.systemAccountsService.getSystemAccountContributionRecords( accountType, page ?? 1, pageSize ?? 20, ); } @Get(':accountType/contribution-stats') @ApiOperation({ summary: '获取系统账户算力明细统计', description: '显示算力来源的汇总信息,包括记录数、来源认种订单数、来源用户数等', }) @ApiParam({ name: 'accountType', type: String, description: '系统账户类型(组合键),如 OPERATION, PROVINCE_440000, CITY_440100', }) async getSystemAccountContributionStats( @Param('accountType') accountType: string, ) { return this.systemAccountsService.getSystemAccountContributionStats(accountType); } }