import { Controller , Get , Post , Body } from '@nestjs/common' ; import { UploadService } from '../service/upload.service' ; import { getQiniu } from '../../../util/upload' ; @ Controller ( 'upload/visitor' ) export class VisitorController { constructor ( private readonly uploadService ) { } @ Get ( '/qiniu-token' ) getQiuNiuToken ( ) { const { token , origin } = getQiniu ( ) ; return { token , origin } ; } @ Post ( '/upload-qiniu-file' ) async uploadQiuNiuFile ( @ Body ( ) fileData ) { return this . uploadService . uploadQiuNiuFile ( fileData ) ; } }