feat: WWJCloud 企业级全栈框架 v0.3.5 完整更新
🚀 核心更新: - ✅ 完善 NestJS 企业级架构设计 - ✅ 优化配置中心和基础设施层 - ✅ 增强第三方服务集成能力 - ✅ 完善多租户架构支持 - 🎯 对标 Java Spring Boot 和 PHP ThinkPHP 📦 新增文件: - wwjcloud-nest 完整框架结构 - Docker 容器化配置 - 管理后台界面 - 数据库迁移脚本 🔑 Key: ebb38b43ec39f355f071294fd1cf9c42
This commit is contained in:
89
src/core/channel/controllers/adminapi/pc.controller.ts
Normal file
89
src/core/channel/controllers/adminapi/pc.controller.ts
Normal file
@@ -0,0 +1,89 @@
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Body,
|
||||
Param,
|
||||
Query,
|
||||
UseGuards,
|
||||
UseInterceptors,
|
||||
UploadedFile,
|
||||
UploadedFiles,
|
||||
Session,
|
||||
Req,
|
||||
} from '@nestjs/common';
|
||||
import { FileInterceptor, FilesInterceptor } from '@nestjs/platform-express';
|
||||
import {
|
||||
ApiTags,
|
||||
ApiOperation,
|
||||
ApiResponse,
|
||||
ApiConsumes,
|
||||
} from '@nestjs/swagger';
|
||||
import { Request } from 'express';
|
||||
import { JwtAuthGuard } from '@wwjCommon/security/guards/jwt-auth.guard';
|
||||
import { RolesGuard } from '@wwjCommon/security/guards/roles.guard';
|
||||
import { Roles } from '@wwjCommon/security/decorators/roles.decorator';
|
||||
import { Public } from '@wwjCommon/security/decorators/public.decorator';
|
||||
import { BusinessException } from '@wwjCommon/exception/business.exception';
|
||||
// @UploadedFile() - 单文件上传,配合 @UseInterceptors(FileInterceptor('file'))
|
||||
// @UploadedFiles() - 多文件上传,配合 @UseInterceptors(FilesInterceptor('files'))
|
||||
// @Session() - 获取会话对象,对应PHP Session::get()
|
||||
// @Req() - 获取Request对象,对应PHP Request
|
||||
import { PcService } from '../../services/admin/pc.service';
|
||||
|
||||
/**
|
||||
* PcController
|
||||
* 对应 PHP: Pc Controller
|
||||
* 对应 Java: @RestController
|
||||
*
|
||||
* 支持装饰器:
|
||||
* - @UploadedFile() - 单文件上传 (对应PHP Request::file())
|
||||
* - @UploadedFiles() - 多文件上传
|
||||
* - @Session() - 会话管理 (对应PHP Session::get())
|
||||
* - @Req() - 请求对象 (对应PHP Request)
|
||||
*/
|
||||
@ApiTags('channel')
|
||||
@Controller('adminapi/channel')
|
||||
export class PcController {
|
||||
constructor(private readonly pcService: PcService) {}
|
||||
|
||||
/**
|
||||
* PC端配置
|
||||
* 路由: GET pc/config
|
||||
* PHP路由: Route::get('pc/config', 'channel.Pc/get')
|
||||
*/
|
||||
@Get('pc/config')
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@ApiOperation({ summary: 'PC端配置' })
|
||||
async get(): Promise<ApiResponse> {
|
||||
try {
|
||||
// 基于PHP真实逻辑实现
|
||||
// PHP原始方法: get
|
||||
|
||||
return await this.pcService.getPc();
|
||||
} catch (error) {
|
||||
throw new BusinessException('get操作失败', error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PC端配置
|
||||
* 路由: PUT pc/config
|
||||
* PHP路由: Route::put('pc/config', 'channel.Pc/set')
|
||||
*/
|
||||
@Put('pc/config')
|
||||
@UseGuards(JwtAuthGuard, RolesGuard)
|
||||
@ApiOperation({ summary: 'PC端配置' })
|
||||
async set(@Body() data: SetDto): Promise<ApiResponse> {
|
||||
try {
|
||||
// 基于PHP真实逻辑实现
|
||||
// PHP原始方法: set
|
||||
|
||||
return await this.pcService.setPc(data);
|
||||
} catch (error) {
|
||||
throw new BusinessException('set操作失败', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user