From 4ef86d8a1f494caa1e136ff78f9ea258d01164b1 Mon Sep 17 00:00:00 2001 From: wupengfei <834520024@qq.com> Date: 星期四, 16 十月 2025 09:28:44 +0800 Subject: [PATCH] Merge branch 'master' into dev-1.1.2 --- apps/cMiniApp/src/utils/storage/index.ts | 1 apps/cMiniApp/.eslintrc-auto-import.json | 3 apps/cMiniApp/src/utils/request/index.ts | 33 + apps/bMiniApp/CHANGELOG.md | 11 apps/cMiniApp/package.json | 4 packages/utils/index.ts | 2 pnpm-lock.yaml | 33 - packages/components/src/Card/TaskCard.vue | 1 packages/services/apiV2/index.ts | 2 apps/cMiniApp/src/constants/app.ts | 1 apps/bMiniApp/src/utils/storage/auth.ts | 2 apps/cMiniApp/src/subpackages/task/taskSubmitCheck/InnerPage.vue | 1 apps/cMiniApp/src/utils/storage/auth.ts | 2 apps/cMiniApp/src/components/Uploader/Uploader.vue | 6 packages/constants/apiEnum.ts | 60 ++ apps/bMiniApp/src/utils/setConfig.ts | 5 apps/bMiniApp/src/utils/request/index.ts | 33 + apps/cMiniApp/src/app.ts | 2 packages/utils/package.json | 3 packages/utils/storage.ts | 2 packages/services/apiV2/logRecords.ts | 39 ++ apps/bMiniApp/package.json | 4 apps/bMiniApp/src/utils/storage/index.ts | 1 apps/cMiniApp/src/subpackages/wallet/mineWallet/InnerPage.vue | 6 apps/cMiniApp/project.private.config.json | 114 +----- packages/services/apiV2/sms.ts | 42 ++ apps/cMiniApp/src/subpackages/task/taskDetail/InnerPage.vue | 1 apps/cMiniApp/src/utils/setConfig.ts | 5 /dev/null | 39 -- apps/cMiniApp/auto-imports.d.ts | 2 apps/cMiniApp/src/subpackages/login/authorization/authorization.vue | 9 packages/utils/LoggerRecord/index.ts | 74 ++++ apps/cMiniApp/CHANGELOG.md | 7 packages/utils/config.ts | 11 apps/bMiniApp/src/app.ts | 2 apps/cMiniApp/project.config.json | 11 packages/services/apiV2/typings.d.ts | 431 +++++++++++++++++++++--- 37 files changed, 763 insertions(+), 242 deletions(-) diff --git a/apps/bMiniApp/CHANGELOG.md b/apps/bMiniApp/CHANGELOG.md index c94533d..8dfe3e2 100644 --- a/apps/bMiniApp/CHANGELOG.md +++ b/apps/bMiniApp/CHANGELOG.md @@ -1,5 +1,16 @@ +## [1.1.4](http://120.26.58.240:8888/r/flexJobMiniApp/compare/@12333/bMiniApp/v1.1.2...@12333/bMiniApp/v1.1.4) (2025-10-15) + + +### Bug Fixes + +* 鏂板鏃ュ織 ([00ea64c](http://120.26.58.240:8888/r/flexJobMiniApp/commits/00ea64ccf296f32a0cc94dcddeaf9f34baccebbb)) +* 淇敼鐏靛伐瀹夋帓 ([c72be85](http://120.26.58.240:8888/r/flexJobMiniApp/commits/c72be856765583aa60e621fbc35da8e3e276aabc)) +* bug ([e2b05af](http://120.26.58.240:8888/r/flexJobMiniApp/commits/e2b05af68baf459155ffd5c08e3d6eaa21136001)) +* s ([03d24a3](http://120.26.58.240:8888/r/flexJobMiniApp/commits/03d24a395c0a5b0aa06445b70da4a9bf26997bb0)) +* s ([d37aa6d](http://120.26.58.240:8888/r/flexJobMiniApp/commits/d37aa6d93da06cf6062ca406f7820ef30d1ee817)) + ## [1.1.3](http://120.26.58.240:8888/r/flexJobMiniApp/compare/@12333/bMiniApp/v1.1.2...@12333/bMiniApp/v1.1.3) (2025-09-26) diff --git a/apps/bMiniApp/package.json b/apps/bMiniApp/package.json index c554aae..645e91c 100644 --- a/apps/bMiniApp/package.json +++ b/apps/bMiniApp/package.json @@ -1,6 +1,6 @@ { "name": "@12333/bMiniApp", - "version": "1.1.3", + "version": "1.1.4", "private": true, "description": "", "templateInfo": { @@ -79,7 +79,7 @@ "pinia": "^2.1.6", "qs": "^6.11.1", "senin-mini": "^1.0.12", - "senior-request": "^1.0.3", + "senior-request": "^1.0.10", "taro-plugin-pinia": "^1.0.0", "vconsole": "^3.15.1", "vue": "3.5.12", diff --git a/apps/bMiniApp/src/app.ts b/apps/bMiniApp/src/app.ts index 5039280..4bd5754 100644 --- a/apps/bMiniApp/src/app.ts +++ b/apps/bMiniApp/src/app.ts @@ -2,7 +2,7 @@ import '@nutui/nutui-taro/dist/style.css'; import './app.scss'; - +import '@/utils/setConfig'; import { setupStore } from '@/stores'; import { useSystemStore } from '@/stores/modules/system'; 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(); diff --git a/apps/bMiniApp/src/utils/setConfig.ts b/apps/bMiniApp/src/utils/setConfig.ts new file mode 100644 index 0000000..6070280 --- /dev/null +++ b/apps/bMiniApp/src/utils/setConfig.ts @@ -0,0 +1,5 @@ +import { setUtilsConfig } from '@12333/utils/config'; + +setUtilsConfig({ + appName: '鐏靛伐杈惧皬绋嬪簭', +}); diff --git a/apps/bMiniApp/src/utils/storage/auth.ts b/apps/bMiniApp/src/utils/storage/auth.ts index e5e8fda..4f4dd24 100644 --- a/apps/bMiniApp/src/utils/storage/auth.ts +++ b/apps/bMiniApp/src/utils/storage/auth.ts @@ -1,4 +1,4 @@ -import { storageLocal } from './storage'; +import { storageLocal } from '@12333/utils'; import { useUserStoreWithOut } from '@/stores/modules/user'; const StorageKey = { diff --git a/apps/bMiniApp/src/utils/storage/index.ts b/apps/bMiniApp/src/utils/storage/index.ts index 3df6b1e..269586e 100644 --- a/apps/bMiniApp/src/utils/storage/index.ts +++ b/apps/bMiniApp/src/utils/storage/index.ts @@ -1,2 +1 @@ -export * from './storage'; export * from './auth'; diff --git a/apps/cMiniApp/.eslintrc-auto-import.json b/apps/cMiniApp/.eslintrc-auto-import.json index 7d2e0af..3901e8e 100644 --- a/apps/cMiniApp/.eslintrc-auto-import.json +++ b/apps/cMiniApp/.eslintrc-auto-import.json @@ -109,6 +109,7 @@ "APP_ENV": true, "DirectiveBinding": true, "MaybeRef": true, - "MaybeRefOrGetter": true + "MaybeRefOrGetter": true, + "NODE_ENV": true } } diff --git a/apps/cMiniApp/CHANGELOG.md b/apps/cMiniApp/CHANGELOG.md index 14d71cc..c3c9ad9 100644 --- a/apps/cMiniApp/CHANGELOG.md +++ b/apps/cMiniApp/CHANGELOG.md @@ -1,5 +1,12 @@ +## [1.1.4](http://120.26.58.240:8888/r/flexJobMiniApp/compare/@12333/cMiniApp/v1.1.3...@12333/cMiniApp/v1.1.4) (2025-10-15) + + +### Bug Fixes + +* 鏂板鏃ュ織 ([00ea64c](http://120.26.58.240:8888/r/flexJobMiniApp/commits/00ea64ccf296f32a0cc94dcddeaf9f34baccebbb)) + ## [1.1.3](http://120.26.58.240:8888/r/flexJobMiniApp/compare/@12333/cMiniApp/v1.1.2...@12333/cMiniApp/v1.1.3) (2025-09-26) diff --git a/apps/cMiniApp/auto-imports.d.ts b/apps/cMiniApp/auto-imports.d.ts index 6ba5ad4..51dd167 100644 --- a/apps/cMiniApp/auto-imports.d.ts +++ b/apps/cMiniApp/auto-imports.d.ts @@ -9,6 +9,7 @@ const AppLocalConfig: typeof import('./src/constants/app')['AppLocalConfig'] const BackType: typeof import('./src/constants/enum')['BackType'] const EffectScope: typeof import('vue')['EffectScope'] + const NODE_ENV: typeof import('./src/constants/app')['NODE_ENV'] const OssAssets: typeof import('./src/constants/img')['OssAssets'] const RouterPath: typeof import('./src/constants/router')['RouterPath'] const TabBarPageRouter: typeof import('./src/constants/tabBar')['TabBarPageRouter'] @@ -124,6 +125,7 @@ readonly AppLocalConfig: UnwrapRef<typeof import('./src/constants/app')['AppLocalConfig']> readonly BackType: UnwrapRef<typeof import('./src/constants/enum')['BackType']> readonly EffectScope: UnwrapRef<typeof import('vue')['EffectScope']> + readonly NODE_ENV: UnwrapRef<typeof import('./src/constants/app')['NODE_ENV']> readonly OssAssets: UnwrapRef<typeof import('./src/constants/img')['OssAssets']> readonly RouterPath: UnwrapRef<typeof import('./src/constants/router')['RouterPath']> readonly TabBarPageRouter: UnwrapRef<typeof import('./src/constants/tabBar')['TabBarPageRouter']> diff --git a/apps/cMiniApp/package.json b/apps/cMiniApp/package.json index 34e05cb..699024e 100644 --- a/apps/cMiniApp/package.json +++ b/apps/cMiniApp/package.json @@ -1,6 +1,6 @@ { "name": "@12333/cMiniApp", - "version": "1.1.3", + "version": "1.1.4", "private": true, "description": "", "templateInfo": { @@ -79,7 +79,7 @@ "pinia": "^2.1.6", "qs": "^6.11.1", "senin-mini": "^1.0.12", - "senior-request": "^1.0.3", + "senior-request": "^1.0.10", "taro-plugin-pinia": "^1.0.0", "vconsole": "^3.15.1", "vue": "3.5.12", diff --git a/apps/cMiniApp/project.config.json b/apps/cMiniApp/project.config.json index cc53dd5..a7a541b 100644 --- a/apps/cMiniApp/project.config.json +++ b/apps/cMiniApp/project.config.json @@ -37,7 +37,11 @@ "showES6CompileOption": false, "useCompilerPlugins": false, "ignoreUploadUnusedFiles": true, - "condition": false + "condition": false, + "compileWorklet": false, + "localPlugins": false, + "swc": false, + "disableSWC": true }, "compileType": "miniprogram", "editorSetting": { @@ -46,10 +50,11 @@ }, "srcMiniprogramRoot": "dist/", "condition": {}, - "libVersion": "3.1.0", + "libVersion": "3.10.0", "packOptions": { "ignore": [], "include": [] }, - "appid": "wxb9e0baf4f87aa0de" + "appid": "wxb9e0baf4f87aa0de", + "simulatorPluginLibVersion": {} } \ No newline at end of file diff --git a/apps/cMiniApp/project.private.config.json b/apps/cMiniApp/project.private.config.json index 61a4ebe..cafa2cd 100644 --- a/apps/cMiniApp/project.private.config.json +++ b/apps/cMiniApp/project.private.config.json @@ -1,93 +1,25 @@ { - "description": "椤圭洰绉佹湁閰嶇疆鏂囦欢銆傛鏂囦欢涓殑鍐呭灏嗚鐩� project.config.json 涓殑鐩稿悓瀛楁銆傞」鐩殑鏀瑰姩浼樺厛鍚屾鍒版鏂囦欢涓�傝瑙佹枃妗o細https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", - "projectname": "cMiniApp", - "setting": { - "compileHotReLoad": true, - "bigPackageSizeSupport": true, - "urlCheck": false - }, - "condition": { - "miniprogram": { - "list": [ - { - "name": "瀹炲悕璁よ瘉", - "pathName": "subpackages/authentication/authenticationRealName/authenticationRealName", - "query": "type=realName", - "launchMode": "default", - "scene": null - }, - { - "name": "鎴戠殑绠�鍘�", - "pathName": "subpackages/curriculum/mineCurriculumVitae/mineCurriculumVitae", - "query": "", - "launchMode": "default", - "scene": null - }, - { - "name": "鍏徃璇︽儏", - "pathName": "subpackages/task/companyDetail/companyDetail", - "query": "id=f775538f-985c-4d51-7985-08ddd5c71bbf", - "launchMode": "default", - "scene": null - }, - { - "name": "浠诲姟璇︽儏", - "pathName": "subpackages/task/taskDetail/taskDetail", - "query": "id=04c75425-e783-4dbf-0f16-08ddd626b756", - "launchMode": "default", - "scene": null - }, - { - "name": "鍩庡競閫夋嫨", - "pathName": "subpackages/city/citySelect/citySelect", - "query": "", - "launchMode": "default", - "scene": null - }, - { - "name": "鏈熸湜宀椾綅", - "pathName": "subpackages/curriculum/expectPosition/expectPosition", - "query": "", - "launchMode": "default", - "scene": null - }, - { - "name": "鎴戠殑绠�鍘�", - "pathName": "subpackages/curriculum/mineCurriculumVitae/mineCurriculumVitae", - "query": "", - "launchMode": "default", - "scene": null - }, - { - "name": "姹傝亴鎰忓悜", - "pathName": "subpackages/curriculum/mineJobIntention/mineJobIntention", - "query": "", - "launchMode": "default", - "scene": null - }, - { - "name": "楠屾敹璇︽儏", - "pathName": "subpackages/task/taskCheckDetail/taskCheckDetail", - "query": "id=57a8f533-2a46-7a88-e008-3a1775810dd2", - "launchMode": "default", - "scene": null - }, - { - "name": "鎻愪氦楠屾敹", - "pathName": "subpackages/task/taskSubmitCheck/taskSubmitCheck", - "query": "id=57a8f533-2a46-7a88-e008-3a1775810dd2", - "launchMode": "default", - "scene": null - }, - { - "name": "浠诲姟", - "pathName": "pages/task/task", - "query": "", - "launchMode": "default", - "scene": null - } - ] - } - }, - "libVersion": "3.10.0" + "description": "椤圭洰绉佹湁閰嶇疆鏂囦欢銆傛鏂囦欢涓殑鍐呭灏嗚鐩� project.config.json 涓殑鐩稿悓瀛楁銆傞」鐩殑鏀瑰姩浼樺厛鍚屾鍒版鏂囦欢涓�傝瑙佹枃妗o細https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "projectname": "cMiniApp", + "setting": { + "compileHotReLoad": true, + "bigPackageSizeSupport": true, + "urlCheck": false, + "coverView": true, + "lazyloadPlaceholderEnable": false, + "skylineRenderEnable": false, + "preloadBackgroundData": false, + "autoAudits": false, + "useApiHook": true, + "useApiHostProcess": true, + "showShadowRootInWxmlPanel": true, + "useStaticServer": false, + "useLanDebug": false, + "showES6CompileOption": false, + "checkInvalidKey": true, + "ignoreDevUnusedFiles": true, + "useIsolateContext": true + }, + "condition": {}, + "libVersion": "3.10.0" } \ No newline at end of file diff --git a/apps/cMiniApp/src/app.ts b/apps/cMiniApp/src/app.ts index 5039280..4bd5754 100644 --- a/apps/cMiniApp/src/app.ts +++ b/apps/cMiniApp/src/app.ts @@ -2,7 +2,7 @@ import '@nutui/nutui-taro/dist/style.css'; import './app.scss'; - +import '@/utils/setConfig'; import { setupStore } from '@/stores'; import { useSystemStore } from '@/stores/modules/system'; diff --git a/apps/cMiniApp/src/components/Uploader/Uploader.vue b/apps/cMiniApp/src/components/Uploader/Uploader.vue index b916f87..037f540 100644 --- a/apps/cMiniApp/src/components/Uploader/Uploader.vue +++ b/apps/cMiniApp/src/components/Uploader/Uploader.vue @@ -4,6 +4,7 @@ v-model:file-list="innerFileList" multiple :media-type="['image']" + :sourceType="sourceType" :before-xhr-upload="beforeXhrUpload" @failure="handleFailure" :maximize="maximize" @@ -23,6 +24,7 @@ v-model:file-list="innerFileList" multiple :media-type="['image']" + :sourceType="sourceType" :before-xhr-upload="beforeXhrUpload" @failure="handleFailure" :maximize="maximize" @@ -47,14 +49,18 @@ name: 'Uploader', }); +type SourceType = 'album' | 'camera'; + type Props = { fileList: FileItem[]; onMySuccess?: (file: FileItem) => any; limitFileSize?: number; + sourceType?: SourceType[]; }; const props = withDefaults(defineProps<Props>(), { limitFileSize: 2, + sourceType: () => ['album', 'camera'], }); const emit = defineEmits<{ diff --git a/apps/cMiniApp/src/constants/app.ts b/apps/cMiniApp/src/constants/app.ts index fb95289..6e317b5 100644 --- a/apps/cMiniApp/src/constants/app.ts +++ b/apps/cMiniApp/src/constants/app.ts @@ -6,3 +6,4 @@ }; export const APP_ENV = process.env.APP_ENV; +export const NODE_ENV = process.env.NODE_ENV; diff --git a/apps/cMiniApp/src/subpackages/login/authorization/authorization.vue b/apps/cMiniApp/src/subpackages/login/authorization/authorization.vue index 691b1f8..e83d1d0 100644 --- a/apps/cMiniApp/src/subpackages/login/authorization/authorization.vue +++ b/apps/cMiniApp/src/subpackages/login/authorization/authorization.vue @@ -25,7 +25,8 @@ v-model="state.policyChecked" policyBtnText="鑻ユ墜鏈哄彿鏈敞鍐岋紝灏嗕负鎮ㄧ洿鎺ユ敞鍐岃处鍙凤紝娉ㄥ唽鍗充负鍚屾剰" /> - <div class="other-login-channel-wrapper" v-if="!isLoginByWeb"> + <!-- <div class="other-login-channel-wrapper" v-if="!isLoginByWeb"> --> + <div class="other-login-channel-wrapper" v-if="NODE_ENV === 'development'"> <nut-divider>鍏朵粬鐧诲綍鏂瑰紡</nut-divider> <div class="other-login-channel-list"> <div class="other-login-channel-list-item" @click="goLoginByForm()"> @@ -34,7 +35,7 @@ </div> <div class="other-login-channel-list-item-text">楠岃瘉鐮佺櫥褰�</div> </div> - <!-- <div + <div class="other-login-channel-list-item" @click="goLoginByForm(LoginFormTabs.AccountLogin)" > @@ -42,7 +43,7 @@ <img :src="IconPassword" /> </div> <div class="other-login-channel-list-item-text">璐︽埛鐧诲綍</div> - </div> --> + </div> </div> </div> </LoginPageLayout> @@ -61,6 +62,8 @@ import IconPassword from '@/assets/login/icon-btn-password.png'; import { LoginFormTabs } from '../constants'; import * as authServices from '@12333/services/apiV2/auth'; +import { NODE_ENV } from '@/constants'; +console.log('NODE_ENV: ', NODE_ENV); defineOptions({ name: 'authorization', diff --git a/apps/cMiniApp/src/subpackages/task/taskDetail/InnerPage.vue b/apps/cMiniApp/src/subpackages/task/taskDetail/InnerPage.vue index 76a83fc..20a4423 100644 --- a/apps/cMiniApp/src/subpackages/task/taskDetail/InnerPage.vue +++ b/apps/cMiniApp/src/subpackages/task/taskDetail/InnerPage.vue @@ -37,6 +37,7 @@ </div> --> </div> <TaskPrice + v-if="detail.releaseStatus !== EnumTaskReleaseStatus.Stopped" :value="toThousand(detail.serviceFee ?? 0)" :unit="BillingMethodEnumUnit[detail.billingMethod]" /> diff --git a/apps/cMiniApp/src/subpackages/task/taskSubmitCheck/InnerPage.vue b/apps/cMiniApp/src/subpackages/task/taskSubmitCheck/InnerPage.vue index f4853a2..06f4438 100644 --- a/apps/cMiniApp/src/subpackages/task/taskSubmitCheck/InnerPage.vue +++ b/apps/cMiniApp/src/subpackages/task/taskSubmitCheck/InnerPage.vue @@ -7,6 +7,7 @@ :maximum="9" :limitFileSize="10" class="bole-uploader nopaddingtop" + :sourceType="['camera']" > </Uploader> </nut-form-item> diff --git a/apps/cMiniApp/src/subpackages/wallet/mineWallet/InnerPage.vue b/apps/cMiniApp/src/subpackages/wallet/mineWallet/InnerPage.vue index 2e85da4..13983cb 100644 --- a/apps/cMiniApp/src/subpackages/wallet/mineWallet/InnerPage.vue +++ b/apps/cMiniApp/src/subpackages/wallet/mineWallet/InnerPage.vue @@ -24,11 +24,7 @@ name: 'InnerPage', }); -const { userDetail } = useUser(); - -const isBindBank = computed(() => - userDetail.value?.bankCardAAccesses?.find(() => EnumUserBankCardAccess.Bank) -); +const { userDetail, isBindBank } = useUser(); function goIncomeDetail() { Taro.navigateTo({ diff --git a/apps/cMiniApp/src/utils/request/index.ts b/apps/cMiniApp/src/utils/request/index.ts index 34b5098..2ebbed6 100644 --- a/apps/cMiniApp/src/utils/request/index.ts +++ b/apps/cMiniApp/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(); diff --git a/apps/cMiniApp/src/utils/setConfig.ts b/apps/cMiniApp/src/utils/setConfig.ts new file mode 100644 index 0000000..2f4e93d --- /dev/null +++ b/apps/cMiniApp/src/utils/setConfig.ts @@ -0,0 +1,5 @@ +import { setUtilsConfig } from '@12333/utils/config'; + +setUtilsConfig({ + appName: '宸ユ槗璧氬皬绋嬪簭', +}); diff --git a/apps/cMiniApp/src/utils/storage/auth.ts b/apps/cMiniApp/src/utils/storage/auth.ts index d82d35c..fb3a306 100644 --- a/apps/cMiniApp/src/utils/storage/auth.ts +++ b/apps/cMiniApp/src/utils/storage/auth.ts @@ -1,4 +1,4 @@ -import { storageLocal } from './storage'; +import { storageLocal } from '@12333/utils'; import { useUserStoreWithOut } from '@/stores/modules/user'; const StorageKey = { diff --git a/apps/cMiniApp/src/utils/storage/index.ts b/apps/cMiniApp/src/utils/storage/index.ts index 3df6b1e..269586e 100644 --- a/apps/cMiniApp/src/utils/storage/index.ts +++ b/apps/cMiniApp/src/utils/storage/index.ts @@ -1,2 +1 @@ -export * from './storage'; export * from './auth'; diff --git a/apps/cMiniApp/src/utils/storage/storage.ts b/apps/cMiniApp/src/utils/storage/storage.ts deleted file mode 100644 index f15fbd6..0000000 --- a/apps/cMiniApp/src/utils/storage/storage.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -import Taro from '@tarojs/taro'; - -//sessionStorage operate -class localStorageProxy { - constructor() {} - - // 瀛� - public setItem(key: string, value: any): void { - return Taro.setStorageSync(key, JSON.stringify(value)); - } - - // 鍙� - public getItem<T = any>(key: string): Nullable<T> { - try { - const value = Taro.getStorageSync(key); - if (value) { - // Do something with return value - return JSON.parse(value); - } - return null; - } catch (e) { - // Do something when catch error - return null; - } - } - - // 鍒� - public removeItem(key: string) { - return Taro.removeStorageSync(key); - } - - // 娓呯┖ - public clear() { - return Taro.clearStorage(); - } -} - -export const storageLocal = new localStorageProxy(); diff --git a/packages/components/src/Card/TaskCard.vue b/packages/components/src/Card/TaskCard.vue index b983916..4f071a2 100644 --- a/packages/components/src/Card/TaskCard.vue +++ b/packages/components/src/Card/TaskCard.vue @@ -4,6 +4,7 @@ <div class="task-card-title">{{ name }}</div> <slot name="title-right"> <TaskPrice + v-if="releaseStatus !== EnumTaskReleaseStatus.Stopped" :value="toThousand(serviceFee ?? 0)" :unit="BillingMethodEnumUnit[billingMethod]" /> diff --git a/packages/constants/apiEnum.ts b/packages/constants/apiEnum.ts index 5e7d264..0d36754 100644 --- a/packages/constants/apiEnum.ts +++ b/packages/constants/apiEnum.ts @@ -31,6 +31,14 @@ ElectronSignUrl = 10, } +/** 鎺у埗鍙版棩蹇楅�氶亾 */ +export enum EnumConsoleLogAccess { + /**鍚庣 */ + Back = 10, + /**鍓嶇 */ + Front = 20, +} + /** 鍚堝悓鍒剁増鐘舵�� */ export enum EnumContractTemplateStatus { /**寰呭埗鐗� */ @@ -199,6 +207,22 @@ Pass = 30, } +/** 鏃ュ織绾у埆 */ +export enum EnumLogLevel { + /**璺熻釜 */ + Trace = 10, + /**璋冭瘯 */ + Debug = 20, + /**淇℃伅 */ + Information = 30, + /**璀﹀憡 */ + Warning = 40, + /**閿欒 */ + Error = 50, + /**涓ラ噸 */ + Critical = 60, +} + /** 鑿滃崟绫诲瀷 */ export enum EnumMenuType { /**鑿滃崟 */ @@ -321,28 +345,30 @@ CommonServerLogRecords = 7, /**鍚屾鏁版嵁搴� */ CommonServerSyncDatabase = 8, + /**鐭俊宸ュ叿 */ + CommonServerSmsUtils = 9, /**鐢ㄦ埛璁よ瘉 */ - UserServerAuth = 9, + UserServerAuth = 10, /**鐢ㄦ埛鑿滃崟 */ - UserServerMenu = 10, + UserServerMenu = 11, /**鐢ㄦ埛璧勬簮 */ - UserServerResource = 11, + UserServerResource = 12, /**鐢ㄦ埛瑙掕壊 */ - UserServerRole = 12, + UserServerRole = 13, /**鐢ㄦ埛淇℃伅 */ - UserServerUser = 13, + UserServerUser = 14, /**鐢靛瓙绛� */ - UserServerElectronSign = 14, + UserServerElectronSign = 15, /**鐢ㄦ埛绠�鍘� */ - UserServerUserResume = 15, + UserServerUserResume = 16, /**浼佷笟淇℃伅 */ - UserServerEnterprise = 16, + UserServerEnterprise = 17, /**浼佷笟閽卞寘 */ - UserServerEnterpriseWallet = 17, + UserServerEnterpriseWallet = 18, /**鐏靛伐淇℃伅 */ - UserServerEnterpriseEmployee = 18, + UserServerEnterpriseEmployee = 19, /**鐢靛瓙绛� */ - ElectronSignServerElectronSign = 19, + ElectronSignServerElectronSign = 20, } /** 璧勬簮璇锋眰鏂瑰紡 */ @@ -391,6 +417,18 @@ AliyunSms = 10, } +/** 鐭俊鐘舵�� */ +export enum EnumSmsStatus { + /**寰呭彂閫� */ + Wait = 0, + /**鍙戦�佷腑 */ + InProcess = 10, + /**鍙戦�佹垚鍔� */ + Success = 20, + /**鍙戦�佸け璐� */ + Fail = 30, +} + /** 浠诲姟缁撶畻鐘舵�� */ export enum EnumTaskCheckReceiveStatus { /**寰呮彁浜� */ diff --git a/packages/services/apiV2/index.ts b/packages/services/apiV2/index.ts index 99078ea..c27a0d6 100644 --- a/packages/services/apiV2/index.ts +++ b/packages/services/apiV2/index.ts @@ -5,6 +5,7 @@ import * as enterpriseEmployee from './enterpriseEmployee'; import * as user from './user'; import * as role from './role'; +import * as sms from './sms'; import * as ocrUtils from './ocrUtils'; import * as task from './task'; import * as enterprise from './enterprise'; @@ -25,6 +26,7 @@ enterpriseEmployee, user, role, + sms, ocrUtils, task, enterprise, diff --git a/packages/services/apiV2/logRecords.ts b/packages/services/apiV2/logRecords.ts index 0cb3919..4780141 100644 --- a/packages/services/apiV2/logRecords.ts +++ b/packages/services/apiV2/logRecords.ts @@ -2,6 +2,18 @@ // @ts-ignore import { request } from '@/utils/request'; +/** 鎺у埗鍙版棩蹇楀垎椤靛垪琛ㄦ煡璇� POST /api/common/logRecords/getConsoleLogs */ +export async function getConsoleLogs(body: API.GetConsoleLogsQuery, options?: API.RequestConfig) { + return request<API.GetConsoleLogsQueryResult>('/api/common/logRecords/getConsoleLogs', { + method: 'POST', + headers: { + 'Content-Type': 'application/json-patch+json', + }, + data: body, + ...(options || {}), + }); +} + /** 鏌ヨ鏁版嵁搴撳璁℃棩蹇楀垎椤靛垪琛� POST /api/common/logRecords/getDbAuditLogs */ export async function getDbAuditLogs(body: API.GetDbAuditLogsQuery, options?: API.RequestConfig) { return request<API.GetDbAuditLogsQueryResult>('/api/common/logRecords/getDbAuditLogs', { @@ -32,6 +44,18 @@ /** 璧勬簮鏃ュ織鍒嗛〉鍒楄〃鏌ヨ POST /api/common/logRecords/getResourceLogs */ export async function getResourceLogs(body: API.GetResourceLogsQuery, options?: API.RequestConfig) { return request<API.GetResourceLogsQueryResult>('/api/common/logRecords/getResourceLogs', { + method: 'POST', + headers: { + 'Content-Type': 'application/json-patch+json', + }, + data: body, + ...(options || {}), + }); +} + +/** 鏌ヨ鐭俊鏃ュ織 POST /api/common/logRecords/getSmsLogs */ +export async function getSmsLogs(body: API.GetSmsLogsQuery, options?: API.RequestConfig) { + return request<API.GetSmsLogsQueryResult>('/api/common/logRecords/getSmsLogs', { method: 'POST', headers: { 'Content-Type': 'application/json-patch+json', @@ -85,3 +109,18 @@ ...(options || {}), }); } + +/** 淇濆瓨鍓嶇鏃ュ織 POST /api/common/logRecords/saveFrontConsoleLog */ +export async function saveFrontConsoleLog( + body: API.SaveFrontConsoleLogCommand, + options?: API.RequestConfig +) { + return request<string>('/api/common/logRecords/saveFrontConsoleLog', { + method: 'POST', + headers: { + 'Content-Type': 'application/json-patch+json', + }, + data: body, + ...(options || {}), + }); +} diff --git a/packages/services/apiV2/sms.ts b/packages/services/apiV2/sms.ts new file mode 100644 index 0000000..5a65279 --- /dev/null +++ b/packages/services/apiV2/sms.ts @@ -0,0 +1,42 @@ +/* eslint-disable */ +// @ts-ignore +import { request } from '@/utils/request'; + +/** 鏌ヨ鐭俊閰嶇疆 POST /api/common/sms/getSmsSetting */ +export async function getSmsSetting(body: API.GetSmsSettingQuery, options?: API.RequestConfig) { + return request<API.GetSmsSettingQueryResult>('/api/common/sms/getSmsSetting', { + method: 'POST', + headers: { + 'Content-Type': 'application/json-patch+json', + }, + data: body, + ...(options || {}), + }); +} + +/** 淇濆瓨鐭俊閰嶇疆 POST /api/common/sms/saveSmsSetting */ +export async function saveSmsSetting(body: API.SaveSmsSettingCommand, options?: API.RequestConfig) { + return request<string>('/api/common/sms/saveSmsSetting', { + method: 'POST', + headers: { + 'Content-Type': 'application/json-patch+json', + }, + data: body, + ...(options || {}), + }); +} + +/** 璇氱珛涓氱煭淇″钩鍙板洖浼犻�氱煡 POST /api/common/sms/smsChengLiYeNotify */ +export async function smsChengLiYeNotify( + body: API.SmsChengLiYeNotifyCommand, + options?: API.RequestConfig +) { + return request<boolean>('/api/common/sms/smsChengLiYeNotify', { + method: 'POST', + headers: { + 'Content-Type': 'application/json-patch+json', + }, + data: body, + ...(options || {}), + }); +} diff --git a/packages/services/apiV2/typings.d.ts b/packages/services/apiV2/typings.d.ts index 5623a46..9794017 100644 --- a/packages/services/apiV2/typings.d.ts +++ b/packages/services/apiV2/typings.d.ts @@ -563,6 +563,13 @@ ElectronSignUrl = 10, } + enum EnumConsoleLogAccess { + /**鍚庣 */ + Back = 10, + /**鍓嶇 */ + Front = 20, + } + enum EnumContractTemplateStatus { /**寰呭埗鐗� */ Wait = 10, @@ -714,6 +721,21 @@ Pass = 30, } + enum EnumLogLevel { + /**璺熻釜 */ + Trace = 10, + /**璋冭瘯 */ + Debug = 20, + /**淇℃伅 */ + Information = 30, + /**璀﹀憡 */ + Warning = 40, + /**閿欒 */ + Error = 50, + /**涓ラ噸 */ + Critical = 60, + } + enum EnumMenuType { /**鑿滃崟 */ Menu = 10, @@ -825,28 +847,30 @@ CommonServerLogRecords = 7, /**鍚屾鏁版嵁搴� */ CommonServerSyncDatabase = 8, + /**鐭俊宸ュ叿 */ + CommonServerSmsUtils = 9, /**鐢ㄦ埛璁よ瘉 */ - UserServerAuth = 9, + UserServerAuth = 10, /**鐢ㄦ埛鑿滃崟 */ - UserServerMenu = 10, + UserServerMenu = 11, /**鐢ㄦ埛璧勬簮 */ - UserServerResource = 11, + UserServerResource = 12, /**鐢ㄦ埛瑙掕壊 */ - UserServerRole = 12, + UserServerRole = 13, /**鐢ㄦ埛淇℃伅 */ - UserServerUser = 13, + UserServerUser = 14, /**鐢靛瓙绛� */ - UserServerElectronSign = 14, + UserServerElectronSign = 15, /**鐢ㄦ埛绠�鍘� */ - UserServerUserResume = 15, + UserServerUserResume = 16, /**浼佷笟淇℃伅 */ - UserServerEnterprise = 16, + UserServerEnterprise = 17, /**浼佷笟閽卞寘 */ - UserServerEnterpriseWallet = 17, + UserServerEnterpriseWallet = 18, /**鐏靛伐淇℃伅 */ - UserServerEnterpriseEmployee = 18, + UserServerEnterpriseEmployee = 19, /**鐢靛瓙绛� */ - ElectronSignServerElectronSign = 19, + ElectronSignServerElectronSign = 20, } enum EnumResourceMethod { @@ -889,6 +913,17 @@ enum EnumSmsAccess { /**闃块噷浜戠煭淇� */ AliyunSms = 10, + } + + enum EnumSmsStatus { + /**寰呭彂閫� */ + Wait = 0, + /**鍙戦�佷腑 */ + InProcess = 10, + /**鍙戦�佹垚鍔� */ + Success = 20, + /**鍙戦�佸け璐� */ + Fail = 30, } enum EnumTaskCheckReceiveStatus { @@ -1223,6 +1258,24 @@ /** 閿欒鐮� */ errorCode?: string; data?: GetCodeUrlQueryResult; + /** 鎵ц鎴愬姛 */ + success?: boolean; + /** 閿欒淇℃伅 */ + msg?: any; + /** 闄勫姞鏁版嵁 */ + extras?: any; + /** 鏃堕棿鎴� */ + timestamp?: number; + } + + interface FriendlyResultGetConsoleLogsQueryResult { + /** 璺熻釜Id */ + traceId?: string; + /** 鐘舵�佺爜 */ + code?: number; + /** 閿欒鐮� */ + errorCode?: string; + data?: GetConsoleLogsQueryResult; /** 鎵ц鎴愬姛 */ success?: boolean; /** 閿欒淇℃伅 */ @@ -1889,6 +1942,42 @@ /** 閿欒鐮� */ errorCode?: string; data?: GetSettlementTaskUsersQueryResult; + /** 鎵ц鎴愬姛 */ + success?: boolean; + /** 閿欒淇℃伅 */ + msg?: any; + /** 闄勫姞鏁版嵁 */ + extras?: any; + /** 鏃堕棿鎴� */ + timestamp?: number; + } + + interface FriendlyResultGetSmsLogsQueryResult { + /** 璺熻釜Id */ + traceId?: string; + /** 鐘舵�佺爜 */ + code?: number; + /** 閿欒鐮� */ + errorCode?: string; + data?: GetSmsLogsQueryResult; + /** 鎵ц鎴愬姛 */ + success?: boolean; + /** 閿欒淇℃伅 */ + msg?: any; + /** 闄勫姞鏁版嵁 */ + extras?: any; + /** 鏃堕棿鎴� */ + timestamp?: number; + } + + interface FriendlyResultGetSmsSettingQueryResult { + /** 璺熻釜Id */ + traceId?: string; + /** 鐘舵�佺爜 */ + code?: number; + /** 閿欒鐮� */ + errorCode?: string; + data?: GetSmsSettingQueryResult; /** 鎵ц鎴愬姛 */ success?: boolean; /** 閿欒淇℃伅 */ @@ -2999,6 +3088,58 @@ paramValue5?: string; } + interface GetConsoleLogsQuery { + access?: EnumConsoleLogAccess; + level?: EnumLogLevel; + /** 鍒涘缓鏃堕棿-璧峰 */ + createdTimeBegin?: string; + /** 鍒涘缓鏃堕棿-鎴 */ + createdTimeEnd?: string; + /** 鎿嶄綔浜� */ + createdUser?: string; + /** 璺熻釜Id */ + traceId?: string; + /** 鍐呭 */ + content?: string; + /** 閾炬帴鍦板潃 */ + url?: string; + /** 浼犲弬 */ + request?: string; + /** 鎵╁睍 */ + ext?: string; + pageModel?: PagedListQueryPageModel; + } + + interface GetConsoleLogsQueryResult { + pageModel?: PagedListQueryResultPageModel; + /** 鏁版嵁 */ + data?: GetConsoleLogsQueryResultItem[]; + } + + interface GetConsoleLogsQueryResultItem { + /** Id */ + id?: string; + /** 璺熻釜Id */ + traceId?: string; + access?: EnumConsoleLogAccess; + level?: EnumLogLevel; + /** 鍐呭 */ + content: string; + /** 鍫嗘爤璺熻釜 */ + stackTrace?: string; + /** 閾炬帴鍦板潃 */ + url?: string; + /** 浼犲弬 */ + request?: string; + /** 鎵╁睍 */ + ext?: string; + /** 瀹㈡埛IP鍦板潃 */ + clientIpAddress?: string; + createdUser?: GetLogsQueryResultItemCreatedUser; + /** 鍒涘缓鏃堕棿 */ + createdTime?: string; + } + interface GetContractTemplateEnterprisesQuery { /** 鍏抽敭瀛� */ keywords?: string; @@ -3074,14 +3215,23 @@ type GetCurrentLogierMenusQuery = Record<string, any>; interface GetDbAuditLogsQuery { - /** 璺熻釜Id */ - traceId?: string; - /** 鍏抽敭瀛� */ - keywords?: string; /** 鍒涘缓鏃堕棿-璧峰 */ createdTimeBegin?: string; /** 鍒涘缓鏃堕棿-鎴 */ createdTimeEnd?: string; + /** 鎿嶄綔浜� */ + createdUser?: string; + /** 璺熻釜Id */ + traceId?: string; + /** 琛ㄥ悕 */ + tableName?: string; + /** 涓婚敭 */ + primaryKey?: string; + operate?: EnumDbAuditOperate; + /** 鏃у�� */ + oldValues?: string; + /** 鏂板�� */ + newValues?: string; pageModel?: PagedListQueryPageModel; } @@ -3092,6 +3242,10 @@ } interface GetDbAuditLogsQueryResultItem { + /** Id */ + id?: string; + /** 璺熻釜Id */ + traceId?: string; /** 琛ㄥ悕 */ tableName?: string; /** 涓婚敭 */ @@ -3101,7 +3255,7 @@ oldValues?: string; /** 鏂板�� */ newValues?: string; - createdUser?: GetResourceLogsQueryResultItemCreatedUser; + createdUser?: GetLogsQueryResultItemCreatedUser; /** 鍒涘缓鏃堕棿 */ createdTime?: string; } @@ -3624,14 +3778,20 @@ } interface GetExceptionLogsQuery { - /** 璺熻釜Id */ - traceId?: string; - /** 鍏抽敭瀛� */ - keywords?: string; /** 鍒涘缓鏃堕棿-璧峰 */ createdTimeBegin?: string; /** 鍒涘缓鏃堕棿-鎴 */ createdTimeEnd?: string; + /** 鎿嶄綔浜� */ + createdUser?: string; + /** 璺熻釜Id */ + traceId?: string; + /** 绫诲瀷 */ + type?: string; + /** 浠g爜 */ + code?: string; + /** 娑堟伅 */ + message?: string; pageModel?: PagedListQueryPageModel; } @@ -3642,6 +3802,10 @@ } interface GetExceptionLogsQueryResultItem { + /** Id */ + id?: string; + /** 璺熻釜Id */ + traceId?: string; /** 绫诲瀷 */ type?: string; /** 浠g爜 */ @@ -3650,7 +3814,7 @@ message?: string; /** 鍫嗘爤璺熻釜 */ stackTrace?: string; - createdUser?: GetResourceLogsQueryResultItemCreatedUser; + createdUser?: GetLogsQueryResultItemCreatedUser; /** 鍒涘缓鏃堕棿 */ createdTime?: string; } @@ -3701,6 +3865,20 @@ /** 鍦板潃 */ url?: string; model?: BaiduOcrBusinessLicenseResultModel; + } + + interface GetLogsQueryResultItemCreatedUser { + /** Id */ + id?: string; + type?: EnumUserType; + /** 濮撳悕 */ + name?: string; + /** 鐢ㄦ埛鍚� */ + userName?: string; + /** 浼佷笟Id */ + enterpriseId?: string; + /** 浼佷笟鍏ㄧО */ + enterpriseName?: string; } interface GetMenuQueryResult { @@ -4366,14 +4544,29 @@ } interface GetResourceLogsQuery { - /** 璺熻釜Id */ - traceId?: string; - /** 鍏抽敭瀛� */ - keywords?: string; /** 鍒涘缓鏃堕棿-璧峰 */ createdTimeBegin?: string; /** 鍒涘缓鏃堕棿-鎴 */ createdTimeEnd?: string; + /** 鎿嶄綔浜� */ + createdUser?: string; + /** 璺熻釜Id */ + traceId?: string; + method?: EnumResourceMethod; + /** 鍩熷悕 */ + domain?: string; + /** 鍦板潃 */ + path?: string; + /** 璇锋眰鍙傛暟 */ + request?: string; + /** 鍝嶅簲缁撴灉 */ + response?: string; + /** 鏄惁鎴愬姛 */ + isSuccess?: boolean; + /** 瀹㈡埛绔疘P鍦板潃 */ + clientIpAddress?: string; + /** 鏈�灏忚�楁椂姣鏁� */ + elapsedMillisecondsMin?: number; pageModel?: PagedListQueryPageModel; } @@ -4386,6 +4579,8 @@ interface GetResourceLogsQueryResultItem { /** Id */ id?: string; + /** 璺熻釜Id */ + traceId?: string; method?: EnumResourceMethod; /** 鍩熷悕 */ domain?: string; @@ -4409,23 +4604,9 @@ consoleLogs?: string; /** 鑰楁椂姣鏁� */ elapsedMilliseconds?: number; - createdUser?: GetResourceLogsQueryResultItemCreatedUser; + createdUser?: GetLogsQueryResultItemCreatedUser; /** 鍒涘缓鏃堕棿 */ createdTime?: string; - } - - interface GetResourceLogsQueryResultItemCreatedUser { - /** Id */ - id?: string; - type?: EnumUserType; - /** 濮撳悕 */ - name?: string; - /** 鐢ㄦ埛鍚� */ - userName?: string; - /** 浼佷笟Id */ - enterpriseId?: string; - /** 浼佷笟鍏ㄧО */ - enterpriseName?: string; } interface GetResourcesQueryResultItem { @@ -4644,6 +4825,89 @@ createdTime?: string; /** 鐢靛瓙鏀舵嵁涓嬭浇閾炬帴 */ ereceiptDownloadOssUrl?: string; + } + + interface GetSmsLogsQuery { + /** 鍒涘缓鏃堕棿-璧峰 */ + createdTimeBegin?: string; + /** 鍒涘缓鏃堕棿-鎴 */ + createdTimeEnd?: string; + /** 鎿嶄綔浜� */ + createdUser?: string; + /** 璺熻釜Id */ + traceId?: string; + access?: EnumSmsAccess; + /** 鎵嬫満鍙风爜 */ + phoneNumber?: string; + /** 妯℃澘浠g爜 */ + templateCode?: string; + /** 妯℃澘鍙傛暟 */ + templateParam?: string; + /** 鏄惁浣跨敤 */ + isUsed?: boolean; + status?: EnumSmsStatus; + pageModel?: PagedListQueryPageModel; + } + + interface GetSmsLogsQueryResult { + pageModel?: PagedListQueryResultPageModel; + /** 鏁版嵁 */ + data?: GetSmsLogsQueryResultItem[]; + } + + interface GetSmsLogsQueryResultItem { + /** Id */ + id?: string; + /** 璺熻釜Id */ + traceId?: string; + access?: EnumSmsAccess; + /** 鎵嬫満鍙风爜 */ + phoneNumber?: string; + /** 妯℃澘浠g爜 */ + templateCode?: string; + /** 妯℃澘鍙傛暟 */ + templateParam?: string; + /** 鏈夋晥鏈� */ + expiry?: string; + /** 鏄惁浣跨敤 */ + isUsed?: boolean; + status?: EnumSmsStatus; + /** 璇锋眰Id */ + requestId?: string; + /** 鍥炰紶浠g爜 */ + code?: string; + /** 鍥炰紶娑堟伅 */ + message?: string; + /** 鎿嶄綔浜篒d */ + createdUserId?: string; + createdUser?: GetLogsQueryResultItemCreatedUser; + /** 鍒涘缓鏃堕棿 */ + createdTime?: string; + } + + type GetSmsSettingQuery = Record<string, any>; + + interface GetSmsSettingQueryResult { + /** 鏄惁绂佺敤 */ + isDisabled?: boolean; + /** 甯﹀嚭鍙傛暟 */ + withoutParams?: boolean; + /** 姣忓垎閽熸渶澶ф暟閲� */ + minutelyMaxCount?: number; + /** 姣忓皬鏃舵渶澶ф暟閲� */ + hourlyMaxCount?: number; + /** 姣忓ぉ鏈�澶ф暟閲� */ + dailyMaxCount?: number; + /** 閫氶亾閰嶇疆 */ + accesses?: GetSmsSettingQueryResultAccess[]; + } + + interface GetSmsSettingQueryResultAccess { + access?: EnumSmsAccess; + /** 鏄惁绂佺敤 */ + isDisabled?: boolean; + /** 鎺掑簭 */ + sort?: number; } interface GetTaskEnterpriseQueryResult { @@ -4929,14 +5193,29 @@ } interface GetThreeResourceLogsQuery { - /** 璺熻釜Id */ - traceId?: string; - /** 鍏抽敭瀛� */ - keywords?: string; /** 鍒涘缓鏃堕棿-璧峰 */ createdTimeBegin?: string; /** 鍒涘缓鏃堕棿-鎴 */ createdTimeEnd?: string; + /** 鎿嶄綔浜� */ + createdUser?: string; + /** 璺熻釜Id */ + traceId?: string; + method?: EnumResourceMethod; + /** 鍩熷悕 */ + domain?: string; + /** 鍦板潃 */ + path?: string; + /** 璇锋眰鍙傛暟 */ + request?: string; + /** 鍝嶅簲缁撴灉 */ + response?: string; + /** 鏄惁鎴愬姛 */ + isSuccess?: boolean; + /** 瀹㈡埛绔疘P鍦板潃 */ + clientIpAddress?: string; + /** 鏈�灏忚�楁椂姣鏁� */ + elapsedMillisecondsMin?: number; pageModel?: PagedListQueryPageModel; } @@ -4949,6 +5228,8 @@ interface GetThreeResourceLogsQueryResultItem { /** Id */ id?: string; + /** 璺熻釜Id */ + traceId?: string; method?: EnumResourceMethod; /** 鍩熷悕 */ domain?: string; @@ -4966,23 +5247,9 @@ isSuccess?: boolean; /** 鑰楁椂姣鏁� */ elapsedMilliseconds?: number; - createdUser?: GetThreeResourceLogsQueryResultItemCreatedUser; + createdUser?: GetLogsQueryResultItemCreatedUser; /** 鍒涘缓鏃堕棿 */ createdTime?: string; - } - - interface GetThreeResourceLogsQueryResultItemCreatedUser { - /** Id */ - id?: string; - type?: EnumUserType; - /** 濮撳悕 */ - name?: string; - /** 鐢ㄦ埛鍚� */ - userName?: string; - /** 浼佷笟Id */ - enterpriseId?: string; - /** 浼佷笟鍏ㄧО */ - enterpriseName?: string; } interface GetTraceIdLogQueryResult { @@ -4994,6 +5261,8 @@ exceptionLogs?: GetExceptionLogsQueryResultItem[]; /** 鏁版嵁搴撳璁℃棩蹇� */ dbAuditLogs?: GetDbAuditLogsQueryResultItem[]; + /** 鎺у埗鍙版棩蹇� */ + consoleLogs?: GetConsoleLogsQueryResultItem[]; } interface GetUserInfoRolesQueryResultItem { @@ -5466,6 +5735,7 @@ } interface PersonalUserElectronSignCommandResult { + userSignContractStatus?: EnumTaskUserSignContractStatus; /** 绛剧讲鍚堝悓鐭摼鎺� */ signContractShortUrl?: string; /** 绛剧讲鍚堝悓闀块摼鎺� */ @@ -5495,6 +5765,8 @@ isReal?: boolean; realMethod?: EnumUserRealMethod; realStatus?: EnumPersonalUserRealStatus; + /** 鏄惁缁戝畾閾惰鍗� */ + isBindBankCard?: boolean; /** 浜鸿劯璇嗗埆鍦板潃 */ faceUrl?: string; } @@ -5691,6 +5963,22 @@ status?: EnumEnterpriseCostStatus; } + interface SaveFrontConsoleLogCommand { + /** 璺熻釜Id */ + traceId?: string; + level?: EnumLogLevel; + /** 鍐呭 */ + content: string; + /** 鍫嗘爤璺熻釜 */ + stackTrace?: string; + /** 閾炬帴鍦板潃 */ + url?: string; + /** 浼犲弬 */ + request?: string; + /** 鎵╁睍 */ + ext?: string; + } + interface SaveMenuButtonCommand { /** 鑿滃崟Id */ parentId?: string; @@ -5848,6 +6136,29 @@ menuIds?: string[]; /** 璧勬簮 */ resources?: GetRoleQueryResultResource[]; + } + + interface SaveSmsSettingCommand { + /** 鏄惁绂佺敤 */ + isDisabled?: boolean; + /** 甯﹀嚭鍙傛暟 */ + withoutParams?: boolean; + /** 姣忓垎閽熸渶澶ф暟閲� */ + minutelyMaxCount?: number; + /** 姣忓皬鏃舵渶澶ф暟閲� */ + hourlyMaxCount?: number; + /** 姣忓ぉ鏈�澶ф暟閲� */ + dailyMaxCount?: number; + /** 閫氶亾閰嶇疆 */ + accesses?: SaveSmsSettingCommandAccess[]; + } + + interface SaveSmsSettingCommandAccess { + access?: EnumSmsAccess; + /** 鏄惁绂佺敤 */ + isDisabled?: boolean; + /** 鎺掑簭 */ + sort?: number; } interface SaveTaskInfoCommand { @@ -6113,6 +6424,8 @@ status?: EnumUserStatus; } + type SmsChengLiYeNotifyCommand = Record<string, any>; + interface SmsLoginCommand { /** 鎵嬫満鍙风爜 */ phoneNumber?: string; diff --git a/packages/utils/LoggerRecord/index.ts b/packages/utils/LoggerRecord/index.ts new file mode 100644 index 0000000..b3552b9 --- /dev/null +++ b/packages/utils/LoggerRecord/index.ts @@ -0,0 +1,74 @@ +import * as logRecordsServices from '@12333/services/apiV2/logRecords'; +import { LoggerRecord, LogOptions, LoggerRecordOptions, LoggerRecordLevel } from 'senior-request'; +import Taro from '@tarojs/taro'; +import { EnumLogLevel } from '@12333/constants'; +import { storageLocal } from '../storage'; +import { getUtilsConfig } from '../config'; + +type HttpLogOptions = { + httpParams?: Omit<API.SaveFrontConsoleLogCommand, 'level' | 'content'>; +} & LogOptions; + +class HttpLoggerRecord extends LoggerRecord<HttpLogOptions> { + constructor(options: LoggerRecordOptions = {}) { + super(options); + } + + convertLogLevel(level: LoggerRecordLevel): EnumLogLevel { + switch (level) { + case 'debug': + return EnumLogLevel.Debug; + case 'info': + return EnumLogLevel.Information; + case 'warn': + return EnumLogLevel.Warning; + case 'error': + return EnumLogLevel.Error; + case 'log': + return EnumLogLevel.Trace; + default: + return EnumLogLevel.Debug; + } + } + + log(level: LoggerRecordLevel, options: HttpLogOptions): void { + const httpUrl = options?.httpParams?.url ?? ''; + if (httpUrl.toLowerCase().includes('saveFrontConsoleLog'.toLowerCase())) return; + const args = [...(options.args || []), options.httpParams].filter(Boolean); + super.log(level, { + ...options, + args: args, + }); + let params: API.SaveFrontConsoleLogCommand = { + /** 璺熻釜Id */ + traceId: options.httpParams?.traceId, + level: this.convertLogLevel(level), + /** 鍐呭 */ + content: `[${this.config.moduleName}] ${options.message}`, + /** 鍫嗘爤璺熻釜 */ + stackTrace: options.httpParams?.stackTrace, + /** 閾炬帴鍦板潃 */ + url: options.httpParams?.url, + ext: JSON.stringify(args), + }; + logRecordsServices.saveFrontConsoleLog(params, { showLoading: false, skipErrorHandler: true }); + } +} + +export const httpLoggerRecord = new HttpLoggerRecord({ + moduleName: getUtilsConfig().appName, + enableStorage: true, + loggerStorageAdapter() { + return { + setItem(key: string, data: any) { + return Promise.resolve(storageLocal.setItem(key, data)); + }, + getItem(key: string) { + return Promise.resolve(storageLocal.getItem(key)); + }, + }; + }, + getPageUrl() { + return Taro.getCurrentInstance()?.router?.path ?? ''; + }, +}); diff --git a/packages/utils/config.ts b/packages/utils/config.ts new file mode 100644 index 0000000..854a5ac --- /dev/null +++ b/packages/utils/config.ts @@ -0,0 +1,11 @@ +export let utilsConfig = { + appName: '', +}; + +export function setUtilsConfig(config: Partial<typeof utilsConfig>) { + utilsConfig = { ...utilsConfig, ...config }; +} + +export function getUtilsConfig() { + return { ...utilsConfig }; +} diff --git a/packages/utils/index.ts b/packages/utils/index.ts index 505a35e..55c474f 100644 --- a/packages/utils/index.ts +++ b/packages/utils/index.ts @@ -16,3 +16,5 @@ export * from './encrypt'; export * from './task'; export * from './developing'; +export * from './LoggerRecord'; +export * from './storage'; diff --git a/packages/utils/package.json b/packages/utils/package.json index b7cf801..88c1390 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -5,6 +5,7 @@ "version": "0.0.1", "dependencies": { "@12333/constants": "workspace:^", - "@12333/services": "workspace:^" + "@12333/services": "workspace:^", + "senior-request": "^1.0.10" } } diff --git a/apps/bMiniApp/src/utils/storage/storage.ts b/packages/utils/storage.ts similarity index 96% rename from apps/bMiniApp/src/utils/storage/storage.ts rename to packages/utils/storage.ts index f15fbd6..dafe99b 100644 --- a/apps/bMiniApp/src/utils/storage/storage.ts +++ b/packages/utils/storage.ts @@ -1,6 +1,8 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import Taro from '@tarojs/taro'; +type Nullable<T> = T | null; + //sessionStorage operate class localStorageProxy { constructor() {} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4164b4a..06c2c52 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -243,8 +243,8 @@ specifier: ^1.0.12 version: 1.0.12(@nutui/icons-vue-taro@0.0.9)(@nutui/nutui-taro@4.3.13)(@tanstack/vue-query@4.35.3)(@tarojs/components@3.6.20)(@tarojs/taro@3.6.20)(axios@1.4.0)(dayjs@1.11.6)(lodash@4.17.21)(vue@3.5.12) senior-request: - specifier: ^1.0.3 - version: 1.0.3(axios@1.4.0) + specifier: ^1.0.10 + version: 1.0.10(axios@1.4.0) taro-plugin-pinia: specifier: ^1.0.0 version: 1.0.0 @@ -505,8 +505,8 @@ specifier: ^1.0.12 version: 1.0.12(@nutui/icons-vue-taro@0.0.9)(@nutui/nutui-taro@4.3.13)(@tanstack/vue-query@4.35.3)(@tarojs/components@3.6.20)(@tarojs/taro@3.6.20)(axios@1.4.0)(dayjs@1.11.6)(lodash@4.17.21)(vue@3.5.12) senior-request: - specifier: ^1.0.3 - version: 1.0.3(axios@1.4.0) + specifier: ^1.0.10 + version: 1.0.10(axios@1.4.0) taro-plugin-pinia: specifier: ^1.0.0 version: 1.0.0 @@ -663,6 +663,9 @@ '@12333/services': specifier: workspace:^ version: link:../services + senior-request: + specifier: ^1.0.10 + version: 1.0.10(axios@1.4.0) packages: @@ -7415,7 +7418,7 @@ /@tencentcloud/call-engine-js@3.3.0: resolution: {integrity: sha512-li4i97RSMM0ZlkK+1x1veRp1sy1YLV/rUNQ1iG8TodHZ4kwA97NnLNBTfvXro3rpJtPVuKIZV6Gp4N+kXy4rOg==} dependencies: - '@tencentcloud/chat': 3.5.7 + '@tencentcloud/chat': 3.5.9 core-js: 3.38.1 eventemitter3: 4.0.7 rtc-detect: 0.0.5 @@ -7426,7 +7429,7 @@ /@tencentcloud/call-engine-wx@3.3.0: resolution: {integrity: sha512-4oXRQhcWiVLX1PxcjCFjnEm53u3oguKsjas7zMvvvgh1UxsA9aiCl6xXIcGZ230w0rP4cQ6hA45S+EZrCIFP1g==} dependencies: - '@tencentcloud/chat': 3.5.7 + '@tencentcloud/chat': 3.5.9 '@tencentcloud/trtc-component-wx': 1.0.6 eventemitter3: 4.0.7 dev: false @@ -7435,7 +7438,7 @@ resolution: {integrity: sha512-XpB8eZriaKDygAvSN3tae2bzD/coQ2u31DyXcAt5VWcATQ1Cf410qZ0ZAa2yf08mhqHcfQtMT0hzi4etZxbZuw==} dependencies: '@tencentcloud/call-engine-wx': 3.3.0 - '@tencentcloud/chat': 3.5.7 + '@tencentcloud/chat': 3.5.9 '@tencentcloud/tui-core': 2.5.1 '@vue/composition-api': 1.7.2(vue@3.5.12) transitivePeerDependencies: @@ -7446,7 +7449,7 @@ resolution: {integrity: sha512-TcbdRiTgeMVHqH6NS/EW0iyJkaIZxgjU3H/11fxNUjrMQsPyggRjtvCpy0nEfmpGpPDd1zp/d5u0f3O8Hj56rg==} dependencies: '@tencentcloud/call-engine-js': 3.3.0 - '@tencentcloud/chat': 3.5.7 + '@tencentcloud/chat': 3.5.9 '@tencentcloud/tui-core': 2.5.1 dev: false @@ -7466,8 +7469,8 @@ tim-upload-plugin: 1.4.3 dev: false - /@tencentcloud/chat-uikit-engine@2.5.5: - resolution: {integrity: sha512-WWFmtpRwNXgtRXWgb0mhzeigFGZimMbgvi1fVmu9sY5+RtF9RiayC/ESokaMVs591l7mcZf4/BXCQNtUi3eZiQ==} + /@tencentcloud/chat-uikit-engine@2.5.6: + resolution: {integrity: sha512-hzGkruR3j5S/9hx7HfGBWvHAZ7FZqpkl5LEz0z9sVm3faG/IaBkeTCjPmvN9kGIdDIan8Jn6mhVW57EEx7E8UQ==} dependencies: '@tencentcloud/chat': 3.5.9 tim-profanity-filter-plugin: 1.1.0 @@ -7480,7 +7483,7 @@ '@tencentcloud/call-uikit-vue': 4.0.9 '@tencentcloud/call-uikit-vue2.6': 4.0.9(vue@3.5.12) '@tencentcloud/call-uikit-wechat': 3.3.9 - '@tencentcloud/chat-uikit-engine': 2.5.5 + '@tencentcloud/chat-uikit-engine': 2.5.6 '@tencentcloud/tui-core': 2.5.1 '@tencentcloud/tui-customer-service-plugin': 2.2.6(@tencentcloud/tui-core@2.5.1)(@vue/composition-api@1.7.2)(vue@3.5.12) '@types/lodash': 4.17.7 @@ -7501,10 +7504,6 @@ - vue - webpack - webpack-sources - dev: false - - /@tencentcloud/chat@3.5.7: - resolution: {integrity: sha512-uxACmaFPqV8jXcORBwVSHc0qgKvnHzRg9kC8kHAqCGbsnsm8525JwFzU6ByckGCNqNWUx/5W70EISYAboLuTvQ==} dev: false /@tencentcloud/chat@3.5.9: @@ -18562,8 +18561,8 @@ axios: 1.4.0 dev: false - /senior-request@1.0.3(axios@1.4.0): - resolution: {integrity: sha512-suWkqlC0qYPRIVUvg5hRf6fXJpWOwkVfiXugzJO4ueDD+799nEQCBUQB4U68mjK9UVhyTY5oK/1Qx83alMqntA==} + /senior-request@1.0.10(axios@1.4.0): + resolution: {integrity: sha512-qHJaP7SrxK+YpiThJII2QXy+nXcjC5liNJizFsAEoFoLQ+eVBSA4hTC/nIC+WD7PEuboFOZCiriCm6KKJbMQBA==} peerDependencies: axios: '*' dependencies: -- Gitblit v1.9.1