From 3e7d895253482b603f7c28e92fbc40c1397e39b7 Mon Sep 17 00:00:00 2001 From: zzh <1368735060@qq.com> Date: Mon, 23 Nov 2026 18:12:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B8=A0=E9=81=93=E6=9B=B4=E6=96=B0=20p?= =?UTF-8?q?ayload=20=E5=B8=A6=E4=B8=8A=E9=BB=91=E5=90=8D=E5=8D=95=E4=B8=8E?= =?UTF-8?q?=E8=AE=A1=E9=87=8D=E5=AD=97=E6=AE=B5=EF=BC=8C=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=90=8E=E5=8F=AF=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- src/api/channel/serviceChannel.ts | 41 ++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/src/api/channel/serviceChannel.ts b/src/api/channel/serviceChannel.ts index 3898be8..5a32178 100644 --- a/src/api/channel/serviceChannel.ts +++ b/src/api/channel/serviceChannel.ts @@ -95,6 +95,9 @@ export type ServiceChannelUpdatePayload = { preScript: string isActive: number remoteAreaId?: number | null + blacklistAreaId?: number | null + weightRuleId?: number | null + weightRoundingId?: number | null } export function buildServiceChannelUpdatePayload( @@ -112,6 +115,9 @@ export function buildServiceChannelUpdatePayload( | 'preScript' | 'isActive' | 'remoteAreaId' + | 'blacklistAreaId' + | 'weightRuleId' + | 'weightRoundingId' > > & { groupId?: number } ): ServiceChannelUpdatePayload { @@ -132,13 +138,17 @@ export function buildServiceChannelUpdatePayload( : isEnableStatusEnabled(activeRaw) ? ENABLE_STATUS.enabled : ENABLE_STATUS.disabled - const resolveRemoteAreaId = (): number | null => { - if (patch.remoteAreaId !== undefined) { - if (patch.remoteAreaId == null || patch.remoteAreaId === ('' as any)) return null - const n = Number(patch.remoteAreaId) + const resolveOptionalPositiveId = ( + patchVal: unknown, + detailCamel: string, + detailPascal: string + ): number | null => { + if (patchVal !== undefined) { + if (patchVal == null || patchVal === '') return null + const n = Number(patchVal) return Number.isFinite(n) && n > 0 ? n : null } - const raw = detail.remoteAreaId ?? detail.RemoteAreaId + const raw = detail[detailCamel] ?? detail[detailPascal] if (raw == null || raw === '') return null const n = Number(raw) return Number.isFinite(n) && n > 0 ? n : null @@ -157,7 +167,26 @@ export function buildServiceChannelUpdatePayload( description: str(patch.description ?? detail.description ?? detail.Description), preScript: str(patch.preScript ?? detail.preScript ?? detail.PreScript), isActive, - remoteAreaId: resolveRemoteAreaId(), + remoteAreaId: resolveOptionalPositiveId( + patch.remoteAreaId, + 'remoteAreaId', + 'RemoteAreaId' + ), + blacklistAreaId: resolveOptionalPositiveId( + patch.blacklistAreaId, + 'blacklistAreaId', + 'BlacklistAreaId' + ), + weightRuleId: resolveOptionalPositiveId( + patch.weightRuleId, + 'weightRuleId', + 'WeightRuleId' + ), + weightRoundingId: resolveOptionalPositiveId( + patch.weightRoundingId, + 'weightRoundingId', + 'WeightRoundingId' + ), } }