chore: clean project config

This commit is contained in:
2026-06-07 02:09:05 +08:00
parent aa593449bb
commit 1b89ce6f71
7 changed files with 15 additions and 69 deletions
@@ -57,7 +57,6 @@ export class OrderLogsService {
let httpStatus: number | null = null;
let responsePayload: unknown | null = null;
let errorMessage: string | null = null;
let status: 'success' | 'failure' = 'failure';
let logged = false;
try {
@@ -71,7 +70,7 @@ export class OrderLogsService {
httpStatus = response.status;
const text = await response.text();
responsePayload = this.parseStreamText(text);
status = response.ok ? 'success' : 'failure';
const status = response.ok ? 'success' : 'failure';
if (!response.ok) {
errorMessage = `HTTP ${response.status}`;
}
@@ -88,7 +87,9 @@ export class OrderLogsService {
logged = true;
if (!response.ok) {
throw new BadRequestException(`第三方 Stream 日志请求失败:HTTP ${response.status}`);
throw new BadRequestException(
`第三方 Stream 日志请求失败:HTTP ${response.status}`,
);
}
return {
@@ -136,7 +137,9 @@ export class OrderLogsService {
const type = String(query.type || '').trim();
const status = String(query.status || '').trim();
const orderId = String(query.orderId || '').trim();
const acts = type ? [this.typeToAct(type)] : Object.values(logTypeActs).concat('streamLogs');
const acts = type
? [this.typeToAct(type)]
: Object.values(logTypeActs).concat('streamLogs');
const builder = this.apiCallLogsRepository
.createQueryBuilder('log')
@@ -183,7 +186,9 @@ export class OrderLogsService {
}
private buildStreamLogUrl(orderId: string) {
const apiUrl = new URL(this.configService.getOrThrow<string>('WK_BASE_URL'));
const apiUrl = new URL(
this.configService.getOrThrow<string>('WK_BASE_URL'),
);
const streamUrl = new URL('/api/streamLogs', apiUrl.origin);
streamUrl.searchParams.set('id', orderId);
return streamUrl.toString();
@@ -272,7 +277,9 @@ export class OrderLogsService {
private getErrorMessage(error: unknown) {
if (error instanceof Error) {
return error.name === 'AbortError' ? '第三方 Stream 日志请求超时' : error.message;
return error.name === 'AbortError'
? '第三方 Stream 日志请求超时'
: error.message;
}
return '第三方 Stream 日志请求失败';
}