diff --git a/content/data/db.sqlite b/content/data/db.sqlite index e39fdef..642bad8 100644 Binary files a/content/data/db.sqlite and b/content/data/db.sqlite differ diff --git a/content/upload/2023-11-23/1700736016850.docx b/content/upload/2023-11-23/1700736016850.docx new file mode 100644 index 0000000..2e89349 Binary files /dev/null and b/content/upload/2023-11-23/1700736016850.docx differ diff --git a/content/upload/2023-11-23/1700738843434.doc b/content/upload/2023-11-23/1700738843434.doc new file mode 100644 index 0000000..ccc347e Binary files /dev/null and b/content/upload/2023-11-23/1700738843434.doc differ diff --git a/src/monitor/log/interceptors/loginLog.interceptor.ts b/src/monitor/log/interceptors/loginLog.interceptor.ts index 22eb724..3a1be1d 100644 --- a/src/monitor/log/interceptors/loginLog.interceptor.ts +++ b/src/monitor/log/interceptors/loginLog.interceptor.ts @@ -11,12 +11,12 @@ export class LoginLogInterceptor implements NestInterceptor { tap({ next: (data) => { const status = true; - const description = '登录成功'; + const description = '用户登录成功'; this.recordLoginLog(context, { status, description }); }, error: (err) => { const status = false; - const description = err?.message || '登录失败'; + const description = err?.message || '用户登录失败'; this.recordLoginLog(context, { status, description }); }, }), diff --git a/src/storage/file/file.module.ts b/src/storage/file/file.module.ts index bd39540..abaafaa 100644 --- a/src/storage/file/file.module.ts +++ b/src/storage/file/file.module.ts @@ -1,33 +1,35 @@ import { ConfigService } from '@/config'; +import { dayjs } from '@/libraries'; import { Module, forwardRef } from '@nestjs/common'; import { MulterModule } from '@nestjs/platform-express'; import { TypeOrmModule } from '@nestjs/typeorm'; import { existsSync, mkdirSync } from 'fs'; import { diskStorage } from 'multer'; import { extname, join } from 'path'; +import { FileCategoryModule } from '../fileCategory'; import { File } from './entities/file.entity'; import { FileController } from './file.controller'; import { FileService } from './file.service'; -import { dayjs } from '@/libraries'; -import { FileCategoryModule } from '../fileCategory'; const MulteredModule = MulterModule.registerAsync({ - useFactory: (config: ConfigService) => { - return { - storage: diskStorage({ - destination: (req, file, next) => { - const dest = join(config.uploadDir, dayjs().format(dayjs.DATE)); - if (!existsSync(dest)) { - mkdirSync(dest, { recursive: true }); - } - next(null, dest); - }, - filename: (req, file, next) => { - next(null, Date.now() + extname(file.originalname)); - }, - }), - }; - }, + useFactory: (config: ConfigService) => ({ + storage: diskStorage({ + destination: (req, file, next) => { + const dest = join(config.uploadDir, dayjs().format(dayjs.DATE)); + if (!existsSync(dest)) { + mkdirSync(dest, { recursive: true }); + } + next(null, dest); + }, + filename: (req, file, next) => { + next(null, Date.now() + extname(file.originalname)); + }, + }), + fileFilter(req, file, callback) { + file.originalname = Buffer.from(file.originalname, 'latin1').toString('utf-8'); + callback(null, true); + }, + }), inject: [ConfigService], });