fix(api): 引入 TextDecoder(gbk) 解决腾讯接口中文乱码,并在前端表单锁定币种联动字段
This commit is contained in:
@@ -29,7 +29,9 @@ export async function syncAllStockPrices() {
|
||||
try {
|
||||
const tCode = getTencentSymbol(asset);
|
||||
const response = await fetch(`https://qt.gtimg.cn/q=${tCode}`, { cache: 'no-store' });
|
||||
const text = await response.text();
|
||||
const arrayBuffer = await response.arrayBuffer();
|
||||
const decoder = new TextDecoder('gbk');
|
||||
const text = decoder.decode(arrayBuffer);
|
||||
|
||||
const match = text.match(/="([^"]+)"/);
|
||||
if (match && match[1]) {
|
||||
|
||||
Reference in New Issue
Block a user