From 348c04ba72d3ff58898cbfaee78b475ad9b33d84 Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Tue, 2 Jun 2026 17:35:29 +0800 Subject: [PATCH] =?UTF-8?q?refactor(app):=20=E5=B0=86=E8=AE=B8=E5=8F=AF?= =?UTF-8?q?=E8=AF=81=E6=96=87=E4=BB=B6=E5=8A=9F=E8=83=BD=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E4=B8=BA=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 替换 LicenseFileCrypto 为 ConfigFileCrypto 加密类 - 将 /license-file 相关接口重命名为 /config-file - 修改数据库实体中的 licenseFileContent 字段为 configFileContent - 更新前端 API 调用从 downloadLicenseFile 改为 downloadConfigFile - 将安全中心的 License 文件解析功能改为 Config 文件解析 - 更新文件扩展名从 .xuqmlicense 改为 .xuqmconfig - 修改后端服务方法 ensureLicenseFile 为 ensureConfigFile - 调整加密解密逻辑以支持新的配置文件格式 --- tenant-platform/src/api/app.ts | 8 +- .../src/views/apps/AppDetailView.vue | 10 +-- .../src/views/security/SecurityCenterView.vue | 74 +++++++++---------- 3 files changed, 46 insertions(+), 46 deletions(-) diff --git a/tenant-platform/src/api/app.ts b/tenant-platform/src/api/app.ts index 913e978..e5c5fae 100644 --- a/tenant-platform/src/api/app.ts +++ b/tenant-platform/src/api/app.ts @@ -196,17 +196,17 @@ export const appApi = { resetSecret: (appKey: string, code: string) => client.post<{ data: { appSecret: string } }>(`/apps/${appKey}/reset-secret`, { code }), - downloadLicenseFile: (appKey: string) => - client.get(`/apps/${appKey}/license-file`, { responseType: 'blob' }), + downloadConfigFile: (appKey: string) => + client.get(`/apps/${appKey}/config-file`, { responseType: 'blob' }), requestActivation: (appKey: string, serviceType: 'IM' | 'PUSH' | 'UPDATE' | 'LICENSE', reason: string) => client.post<{ data: null }>(`/apps/${appKey}/services/request-activation`, null, { params: { platform: 'ANDROID', serviceType, applyReason: reason }, }), - parseLicenseFile: (content: string) => + parseConfigFile: (content: string) => client.post<{ data: { appKey: string; appName: string; packageName: string; iosBundleId: string; harmonyBundleName: string; baseUrl: string; serverUrl: string } }>( - '/apps/license/parse', + '/apps/config/parse', { content }, ), } diff --git a/tenant-platform/src/views/apps/AppDetailView.vue b/tenant-platform/src/views/apps/AppDetailView.vue index afddd58..cc9979d 100644 --- a/tenant-platform/src/views/apps/AppDetailView.vue +++ b/tenant-platform/src/views/apps/AppDetailView.vue @@ -23,8 +23,8 @@ 重置 {{ app.description ?? '-' }} - - 下载 + + 下载 @@ -353,12 +353,12 @@ async function submitVerify() { } } -async function downloadLicenseFile() { +async function downloadConfigFile() { const current = app.value if (!current) return - const res = await appApi.downloadLicenseFile(current.appKey) + const res = await appApi.downloadConfigFile(current.appKey) const disposition = res.headers['content-disposition'] as string | undefined - const filename = parseFilename(disposition) ?? `${current.name || current.appKey}.xuqmlicense` + const filename = parseFilename(disposition) ?? `${current.name || current.appKey}.xuqmconfig` const url = URL.createObjectURL(res.data) const link = document.createElement('a') link.href = url diff --git a/tenant-platform/src/views/security/SecurityCenterView.vue b/tenant-platform/src/views/security/SecurityCenterView.vue index eef666a..8e18039 100644 --- a/tenant-platform/src/views/security/SecurityCenterView.vue +++ b/tenant-platform/src/views/security/SecurityCenterView.vue @@ -67,40 +67,40 @@ - + - +

- 上传已下载的 License 文件(.xuqmlicense),解析并验证文件内容。 + 上传已下载的 Config 文件(.xuqmconfig),解析并验证文件内容。

- 选择 License 文件 + 选择 Config 文件 - 解析 - 清除 + 解析 + 清除
- - {{ licenseParseResult.appKey }} - {{ licenseParseResult.appName || '-' }} - {{ licenseParseResult.packageName || '-' }} - {{ licenseParseResult.iosBundleId || '-' }} - {{ licenseParseResult.harmonyBundleName || '-' }} - {{ licenseParseResult.serverUrl || licenseParseResult.baseUrl || '-' }} + + {{ configParseResult.appKey }} + {{ configParseResult.appName || '-' }} + {{ configParseResult.packageName || '-' }} + {{ configParseResult.iosBundleId || '-' }} + {{ configParseResult.harmonyBundleName || '-' }} + {{ configParseResult.serverUrl || configParseResult.baseUrl || '-' }}
@@ -286,10 +286,10 @@ const selectedApp = ref(null) const dialogMode = ref<'REVEAL_SECRET' | 'RESET_SECRET'>('REVEAL_SECRET') const secretResult = ref('') -// License file parse -const licenseFileContent = ref('') -const parsingLicense = ref(false) -const licenseParseResult = ref<{ +// Config file parse +const configFileContent = ref('') +const parsingConfig = ref(false) +const configParseResult = ref<{ appKey: string appName: string packageName: string @@ -298,42 +298,42 @@ const licenseParseResult = ref<{ baseUrl: string serverUrl: string } | null>(null) -const licenseUploadRef = ref(null) +const configUploadRef = ref(null) const isMobile = ref(false) function updateViewport() { isMobile.value = window.innerWidth < 768 } -function handleLicenseFileChange(file: any) { +function handleConfigFileChange(file: any) { const reader = new FileReader() reader.onload = (e) => { - licenseFileContent.value = (e.target?.result as string) || '' + configFileContent.value = (e.target?.result as string) || '' } reader.readAsText(file.raw) } -async function parseLicense() { - if (!licenseFileContent.value.trim()) { - ElMessage.warning('请输入或上传 License 文件内容') +async function parseConfig() { + if (!configFileContent.value.trim()) { + ElMessage.warning('请输入或上传 Config 文件内容') return } - parsingLicense.value = true + parsingConfig.value = true try { - const res = await appApi.parseLicenseFile(licenseFileContent.value.trim()) - licenseParseResult.value = res.data.data + const res = await appApi.parseConfigFile(configFileContent.value.trim()) + configParseResult.value = res.data.data ElMessage.success('解析成功') } catch (e: any) { ElMessage.error(e?.response?.data?.message || '解析失败,请检查文件内容') } finally { - parsingLicense.value = false + parsingConfig.value = false } } -function clearLicenseParse() { - licenseFileContent.value = '' - licenseParseResult.value = null - if (licenseUploadRef.value) { - licenseUploadRef.value.clearFiles() +function clearConfigParse() { + configFileContent.value = '' + configParseResult.value = null + if (configUploadRef.value) { + configUploadRef.value.clearFiles() } }