From b366bf585c6636c717423560bde93d6cc038a0a8 Mon Sep 17 00:00:00 2001 From: "Apple\\Apple" Date: Wed, 4 Jun 2025 15:29:10 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(channels):=20resolve=20type?= =?UTF-8?q?=20mismatch=20when=20copying=20tested=20channels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix JSON unmarshal error that occurred when copying channels after testing. The JavaScript timestamp (floating point number) in the test_time field was causing type conversion errors in Go backend which expected an int64. Solution: - Create deep copy of channel record instead of modifying original - Remove test_time and response_time fields before sending to backend - Allow backend to use default values for these fields Error fixed: "json: cannot unmarshal number into Go struct field Channel.test_time of type int64" --- web/src/components/table/ChannelsTable.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/src/components/table/ChannelsTable.js b/web/src/components/table/ChannelsTable.js index 9081aa63..c32bcff3 100644 --- a/web/src/components/table/ChannelsTable.js +++ b/web/src/components/table/ChannelsTable.js @@ -878,11 +878,14 @@ const ChannelsTable = () => { }; const copySelectedChannel = async (record) => { - const channelToCopy = record; + const channelToCopy = { ...record }; channelToCopy.name += t('_复制'); channelToCopy.created_time = null; channelToCopy.balance = 0; channelToCopy.used_quota = 0; + // 删除可能导致类型不匹配的字段 + delete channelToCopy.test_time; + delete channelToCopy.response_time; if (!channelToCopy) { showError(t('渠道未找到,请刷新页面后重试。')); return;