diff --git a/backend/services/mining-admin-service/src/api/controllers/config.controller.ts b/backend/services/mining-admin-service/src/api/controllers/config.controller.ts index 1d610075..8d824ac0 100644 --- a/backend/services/mining-admin-service/src/api/controllers/config.controller.ts +++ b/backend/services/mining-admin-service/src/api/controllers/config.controller.ts @@ -37,28 +37,6 @@ export class ConfigController { return { success: true }; } - @Get(':category/:key') - @ApiOperation({ summary: '获取单个配置' }) - @ApiParam({ name: 'category' }) - @ApiParam({ name: 'key' }) - async getConfig(@Param('category') category: string, @Param('key') key: string) { - return this.configService.getConfig(category, key); - } - - @Post() - @ApiOperation({ summary: '设置配置' }) - async setConfig(@Body() dto: SetConfigDto, @Req() req: any) { - await this.configService.setConfig(req.admin.id, dto.category, dto.key, dto.value, dto.description); - return { success: true }; - } - - @Delete(':category/:key') - @ApiOperation({ summary: '删除配置' }) - async deleteConfig(@Param('category') category: string, @Param('key') key: string, @Req() req: any) { - await this.configService.deleteConfig(req.admin.id, category, key); - return { success: true }; - } - @Get('mining/status') @ApiOperation({ summary: '获取挖矿状态' }) async getMiningStatus() { @@ -71,11 +49,9 @@ export class ConfigController { } const result = await response.json(); this.logger.log(`Mining service response: ${JSON.stringify(result)}`); - // mining-service 返回 { success, data, timestamp },需要解包 data if (result.data) { return result.data; } - // 如果没有 data 字段,返回错误状态 return { initialized: false, isActive: false, @@ -130,4 +106,26 @@ export class ConfigController { return { success: false, message: 'Failed to deactivate mining' }; } } + + @Get(':category/:key') + @ApiOperation({ summary: '获取单个配置' }) + @ApiParam({ name: 'category' }) + @ApiParam({ name: 'key' }) + async getConfig(@Param('category') category: string, @Param('key') key: string) { + return this.configService.getConfig(category, key); + } + + @Post() + @ApiOperation({ summary: '设置配置' }) + async setConfig(@Body() dto: SetConfigDto, @Req() req: any) { + await this.configService.setConfig(req.admin.id, dto.category, dto.key, dto.value, dto.description); + return { success: true }; + } + + @Delete(':category/:key') + @ApiOperation({ summary: '删除配置' }) + async deleteConfig(@Param('category') category: string, @Param('key') key: string, @Req() req: any) { + await this.configService.deleteConfig(req.admin.id, category, key); + return { success: true }; + } }