From eb01fa3052576eb05faa83bb6b094aa5f85a4408 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期日, 19 十月 2025 17:29:38 +0800
Subject: [PATCH] Merge branch 'dev-1.2.0.1' of http://120.26.58.240:8888/r/flexJobMiniApp into dev-1.2.0.1
---
apps/bMiniApp/src/utils/request/index.ts | 33 ++++++++++++++++++++++++++++++++-
1 files changed, 32 insertions(+), 1 deletions(-)
diff --git a/apps/bMiniApp/src/utils/request/index.ts b/apps/bMiniApp/src/utils/request/index.ts
index 34b5098..2ebbed6 100644
--- a/apps/bMiniApp/src/utils/request/index.ts
+++ b/apps/bMiniApp/src/utils/request/index.ts
@@ -3,7 +3,7 @@
import qs from 'qs';
import Taro from '@tarojs/taro';
import { getToken } from '@/utils';
-import { tokenIsExpired, Message, SensitiveManage } from '@12333/utils';
+import { tokenIsExpired, Message, SensitiveManage, httpLoggerRecord } from '@12333/utils';
import { useUserStoreWithOut } from '@/stores/modules/user';
const RefreshTokenUrl = '/gettokenbyrefreshtoken';
@@ -63,6 +63,7 @@
*/
msg?: string;
showType?: ErrorShowType;
+ traceId?: string;
}
interface ErrorResponse {
@@ -103,6 +104,19 @@
// 閿欒鎺ユ敹鍙婂鐞�
errorHandler: (error, opts) => {
console.log('error: ', error);
+
+ const url = opts.url ?? '';
+ httpLoggerRecord.error({
+ message: `[${url}] 璇锋眰閿欒`,
+ httpParams: {
+ url: url,
+ //@ts-ignore
+ traceId: error?.info?.traceId,
+ stackTrace: error.stack,
+ },
+ args: [{ data: opts.data, params: opts.params, headers: opts.headers }],
+ });
+
if (opts?.skipErrorHandler) throw error;
if (opts?.customErrorHandler) {
@@ -172,6 +186,14 @@
(config) => {
const $config = config;
+ httpLoggerRecord.info({
+ message: `[${$config.url}] 璇锋眰寮�濮媊,
+ httpParams: {
+ url: $config.url,
+ },
+ args: [{ data: $config.data, params: $config.params, headers: $config.headers }],
+ });
+
const token = getToken();
const userStore = useUserStoreWithOut();
@@ -216,6 +238,15 @@
(response) => {
const $config = response.config as IRequestOptions;
+ httpLoggerRecord.info({
+ message: `[${$config.url}] 璇锋眰缁撴潫`,
+ httpParams: {
+ url: $config.url,
+ traceId: response.data?.traceId,
+ },
+ args: [{ data: $config.data, params: $config.params, headers: $config.headers }],
+ });
+
const { needNProcess, getResponse = false } = $config;
const userStore = useUserStoreWithOut();
--
Gitblit v1.9.1