🐛 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"
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user