Skip to content

Commit b366bf5

Browse files
author
Apple\Apple
committed
🐛 fix(channels): resolve type mismatch when copying tested channels
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"
1 parent 494c386 commit b366bf5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

web/src/components/table/ChannelsTable.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,11 +878,14 @@ const ChannelsTable = () => {
878878
};
879879

880880
const copySelectedChannel = async (record) => {
881-
const channelToCopy = record;
881+
const channelToCopy = { ...record };
882882
channelToCopy.name += t('_复制');
883883
channelToCopy.created_time = null;
884884
channelToCopy.balance = 0;
885885
channelToCopy.used_quota = 0;
886+
// 删除可能导致类型不匹配的字段
887+
delete channelToCopy.test_time;
888+
delete channelToCopy.response_time;
886889
if (!channelToCopy) {
887890
showError(t('渠道未找到,请刷新页面后重试。'));
888891
return;

0 commit comments

Comments
 (0)