From b5eb4fdbcec27808a6e32a91b263cf1a5bbc7495 Mon Sep 17 00:00:00 2001 From: sexygoat <1538832180@qq.com> Date: Mon, 13 Apr 2026 14:35:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=BC=96=E8=BE=91=E4=B8=8D=E4=BC=A0=E9=80=92?= =?UTF-8?q?=E8=84=B1=E6=95=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- opencode.json | 4 +- src/views/settings/wechat-config/index.vue | 62 ++++++++++++---------- 2 files changed, 35 insertions(+), 31 deletions(-) diff --git a/opencode.json b/opencode.json index 83fe564..9983b76 100644 --- a/opencode.json +++ b/opencode.json @@ -7,9 +7,9 @@ "apiKey": "sk-ZBGcMXCdwtSK7G35s" } }, - "minimax": { + "google": { "options": { - "baseURL": "http://45.155.220.179:8317/v1", + "baseURL": "http://45.155.220.179:8317/v1beta", "apiKey": "sk-ZBGcMXCdwtSK7G35s" } } diff --git a/src/views/settings/wechat-config/index.vue b/src/views/settings/wechat-config/index.vue index 16cde3e..97cfcb7 100644 --- a/src/views/settings/wechat-config/index.vue +++ b/src/views/settings/wechat-config/index.vue @@ -788,12 +788,11 @@ }) } - // 处理敏感字段值 - 如果是***或[已配置]等特殊值,转换为空字符串 - const processSensitiveField = (value: string | undefined | null): string => { - if (!value || value === '***' || value.includes('[已配置]') || value.includes('[未配置]')) { - return '' - } - return value + // 检查是否是脱敏数据 + const isMaskedData = (value: string | undefined | null): boolean => { + if (!value) return false + // 检查是否包含脱敏标记:纯星号、已配置标记、或包含连续星号(脱敏数据如Wuha***1218) + return value === '***' || value.includes('[已配置]') || value.includes('[未配置]') || /\*{2,}/.test(value) } // 显示编辑对话框 @@ -803,33 +802,33 @@ const res = await WechatConfigService.getWechatConfigById(row.id) if (res.code === 0 && res.data) { const detail = res.data - // 赋值表单数据 + // 赋值表单数据(保持脱敏数据原样显示) Object.assign(form, { id: detail.id, name: detail.name, provider_type: detail.provider_type, description: detail.description || '', miniapp_app_id: detail.miniapp_app_id || '', - miniapp_app_secret: processSensitiveField(detail.miniapp_app_secret), + miniapp_app_secret: detail.miniapp_app_secret || '', oa_app_id: detail.oa_app_id || '', - oa_app_secret: processSensitiveField(detail.oa_app_secret), - oa_token: processSensitiveField(detail.oa_token), - oa_aes_key: processSensitiveField(detail.oa_aes_key), + oa_app_secret: detail.oa_app_secret || '', + oa_token: detail.oa_token || '', + oa_aes_key: detail.oa_aes_key || '', oa_oauth_redirect_url: detail.oa_oauth_redirect_url || '', wx_mch_id: detail.wx_mch_id || '', - wx_api_v2_key: processSensitiveField(detail.wx_api_v2_key), - wx_api_v3_key: processSensitiveField(detail.wx_api_v3_key), + wx_api_v2_key: detail.wx_api_v2_key || '', + wx_api_v3_key: detail.wx_api_v3_key || '', wx_notify_url: detail.wx_notify_url || '', wx_serial_no: detail.wx_serial_no || '', - wx_cert_content: processSensitiveField(detail.wx_cert_content), - wx_key_content: processSensitiveField(detail.wx_key_content), + wx_cert_content: detail.wx_cert_content || '', + wx_key_content: detail.wx_key_content || '', fy_api_url: detail.fy_api_url || '', fy_ins_cd: detail.fy_ins_cd || '', fy_mchnt_cd: detail.fy_mchnt_cd || '', fy_term_id: detail.fy_term_id || '', fy_notify_url: detail.fy_notify_url || '', - fy_private_key: processSensitiveField(detail.fy_private_key), - fy_public_key: processSensitiveField(detail.fy_public_key) + fy_private_key: detail.fy_private_key || '', + fy_public_key: detail.fy_public_key || '' }) dialogType.value = 'edit' dialogVisible.value = true @@ -856,6 +855,11 @@ // 只需要什么都不做,下次打开时会重新赋值 } + // 判断字段值是否有效(不是空且不是脱敏数据) + const isValidFieldValue = (value: string | undefined): boolean => { + return !!value && !isMaskedData(value) + } + // 提交表单 const handleSubmit = async () => { if (!formRef.value) return @@ -898,19 +902,19 @@ name: form.name, description: form.description || undefined } - // 只有填写了新值才更新敏感字段 - if (form.miniapp_app_secret) data.miniapp_app_secret = form.miniapp_app_secret - if (form.oa_app_secret) data.oa_app_secret = form.oa_app_secret - if (form.oa_token) data.oa_token = form.oa_token - if (form.oa_aes_key) data.oa_aes_key = form.oa_aes_key - if (form.wx_api_v2_key) data.wx_api_v2_key = form.wx_api_v2_key - if (form.wx_api_v3_key) data.wx_api_v3_key = form.wx_api_v3_key - if (form.wx_cert_content) data.wx_cert_content = form.wx_cert_content - if (form.wx_key_content) data.wx_key_content = form.wx_key_content - if (form.fy_private_key) data.fy_private_key = form.fy_private_key - if (form.fy_public_key) data.fy_public_key = form.fy_public_key + // 只有填写了有效的新值才更新敏感字段(不是空值且不是脱敏数据) + if (isValidFieldValue(form.miniapp_app_secret)) data.miniapp_app_secret = form.miniapp_app_secret + if (isValidFieldValue(form.oa_app_secret)) data.oa_app_secret = form.oa_app_secret + if (isValidFieldValue(form.oa_token)) data.oa_token = form.oa_token + if (isValidFieldValue(form.oa_aes_key)) data.oa_aes_key = form.oa_aes_key + if (isValidFieldValue(form.wx_api_v2_key)) data.wx_api_v2_key = form.wx_api_v2_key + if (isValidFieldValue(form.wx_api_v3_key)) data.wx_api_v3_key = form.wx_api_v3_key + if (isValidFieldValue(form.wx_cert_content)) data.wx_cert_content = form.wx_cert_content + if (isValidFieldValue(form.wx_key_content)) data.wx_key_content = form.wx_key_content + if (isValidFieldValue(form.fy_private_key)) data.fy_private_key = form.fy_private_key + if (isValidFieldValue(form.fy_public_key)) data.fy_public_key = form.fy_public_key - // 非敏感字段总是更新 + // 非敏感字段:如果有值就更新 if (form.miniapp_app_id) data.miniapp_app_id = form.miniapp_app_id if (form.oa_app_id) data.oa_app_id = form.oa_app_id if (form.oa_oauth_redirect_url) data.oa_oauth_redirect_url = form.oa_oauth_redirect_url