From 0c890318929acd1a26ebb136710e2e2a47189455 Mon Sep 17 00:00:00 2001 From: zhangtao25 Date: Wed, 25 Dec 2024 13:23:39 +0800 Subject: [PATCH] chore: daily development --- .../canyon-collect/src/apps/auth/guards/jwt-auth.guard.ts | 6 ++++++ .../canyon-collect/src/apps/collect/collect.controller.ts | 4 ++-- .../apps/collect/services/coverage-map-client.service.ts | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/canyon-collect/src/apps/auth/guards/jwt-auth.guard.ts b/packages/canyon-collect/src/apps/auth/guards/jwt-auth.guard.ts index c186c970..0291a9bc 100755 --- a/packages/canyon-collect/src/apps/auth/guards/jwt-auth.guard.ts +++ b/packages/canyon-collect/src/apps/auth/guards/jwt-auth.guard.ts @@ -8,6 +8,12 @@ export class JwtAuthGuard extends AuthGuard("jwt") { super(); } canActivate(context: ExecutionContext): any { + const request = context.switchToHttp().getRequest(); + // 获取请求体 + const requestBody = request.body; + if (Object.keys(requestBody).length === 0) { + return true; + } return super.canActivate(context); } } diff --git a/packages/canyon-collect/src/apps/collect/collect.controller.ts b/packages/canyon-collect/src/apps/collect/collect.controller.ts index 19025a6b..b453bb9e 100644 --- a/packages/canyon-collect/src/apps/collect/collect.controller.ts +++ b/packages/canyon-collect/src/apps/collect/collect.controller.ts @@ -53,7 +53,7 @@ export class CollectController { if (coverageClientDto.coverage) { return this.coverageClientService.invoke({ ...coverageClientDto, - reporter: String(req.user.id), + reporter: String(req?.user?.id || "canyon"), }); } let coverage = {}; @@ -71,7 +71,7 @@ export class CollectController { return this.coverageClientService.invoke({ ...coverageClientDto, coverage, - reporter: String(req.user.id), + reporter: String(req?.user?.id || "canyon"), }); } diff --git a/packages/canyon-collect/src/apps/collect/services/coverage-map-client.service.ts b/packages/canyon-collect/src/apps/collect/services/coverage-map-client.service.ts index 6209d489..27bcba2b 100755 --- a/packages/canyon-collect/src/apps/collect/services/coverage-map-client.service.ts +++ b/packages/canyon-collect/src/apps/collect/services/coverage-map-client.service.ts @@ -87,7 +87,7 @@ export class CoverageMapClientService { }, }) .catch(() => { - console.log("coverage create error"); + // console.log("coverage create error"); }); /*