From 1b3c94603a6ce3c826c97d23b2df6ce30f97810a Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Fri, 26 Jun 2026 16:16:08 +0800 Subject: [PATCH] =?UTF-8?q?fix(push-config):=20=E4=BF=AE=E5=A4=8D=E5=8E=82?= =?UTF-8?q?=E5=95=86=E5=87=AD=E6=8D=AE=E6=97=A0=E6=B3=95=E5=9B=9E=E6=98=BE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 getServiceItem API,按平台精确查询推送服务配置(/services/item) - applySelectedPlatformConfig 改用精确接口而非列表,避免 listByApp 只返回第一条 PUSH 服务(IOS)导致 ANDROID 配置加载为空的问题 Co-Authored-By: Claude Sonnet 4.6 --- tenant-platform/src/api/app.ts | 5 +++++ .../src/views/push/PushConfigView.vue | 16 ++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tenant-platform/src/api/app.ts b/tenant-platform/src/api/app.ts index fd33b6f..e095458 100644 --- a/tenant-platform/src/api/app.ts +++ b/tenant-platform/src/api/app.ts @@ -170,6 +170,11 @@ export const appApi = { } as typeof res & { data: { data: FeatureService } } }, + getServiceItem: (appKey: string, platform: string, serviceType: string) => + client.get<{ data: FeatureService }>(`/apps/${appKey}/services/item`, { + params: { platform, serviceType }, + }), + toggleService: (appKey: string, platform: string, serviceType: string, enable: boolean) => client.post<{ data: FeatureService }>(`/apps/${appKey}/services/toggle`, null, { params: { platform, serviceType, enable }, diff --git a/tenant-platform/src/views/push/PushConfigView.vue b/tenant-platform/src/views/push/PushConfigView.vue index f6d7697..7410e3b 100644 --- a/tenant-platform/src/views/push/PushConfigView.vue +++ b/tenant-platform/src/views/push/PushConfigView.vue @@ -528,17 +528,21 @@ async function loadData() { services.value = svcRes.data.data // Always default to ANDROID on load; user can switch via the platform selector selectedPlatform.value = 'ANDROID' - applySelectedPlatformConfig() + await applySelectedPlatformConfig() } finally { loading.value = false } } -function applySelectedPlatformConfig() { - const raw = services.value.find( - s => s.serviceType === 'PUSH' && s.platform === selectedPlatform.value, - )?.config - replaceState(parseConfig(raw)) +async function applySelectedPlatformConfig() { + if (!app.value) return + try { + const res = await appApi.getServiceItem(app.value.appKey, selectedPlatform.value, 'PUSH') + replaceState(parseConfig(res.data.data?.config)) + } catch { + // 该平台尚无配置,清空表单 + replaceState(parseConfig(null)) + } } function buildPayload(): PushServiceConfig {