mirror of
https://github.com/zhangxiangliang/stock-api.git
synced 2025-02-02 14:18:44 +08:00
fix: 修复 网易类型股票代码错误未处理问题
This commit is contained in:
parent
3f8eb09e68
commit
30e40bcc8d
@ -27,18 +27,13 @@ const Netease: StockApi = {
|
||||
|
||||
const items = JSON.parse(res.body.toString().replace(/\(|\)|;|(topstock)|\s/g, '').replace('{{', '{').replace('}}}', "}}"));
|
||||
const params = items[transform];
|
||||
|
||||
if (!params) {
|
||||
return { ...DEFAULT_STOCK, code };
|
||||
}
|
||||
|
||||
const data = (new NeteaseStockTransform(code, params));
|
||||
|
||||
return params ? data.getStock() : {
|
||||
code: code,
|
||||
name: '---',
|
||||
percent: 0,
|
||||
|
||||
now: 0,
|
||||
low: 0,
|
||||
high: 0,
|
||||
yesterday: 0,
|
||||
};
|
||||
return data.getStock();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -62,9 +57,14 @@ const Netease: StockApi = {
|
||||
return codes.map(code => {
|
||||
const transform = (new NeteaseCommonCodeTransform).transform(code);
|
||||
const params = items[transform];
|
||||
|
||||
if (!params) {
|
||||
return { ...DEFAULT_STOCK, code };
|
||||
}
|
||||
|
||||
const data = (new NeteaseStockTransform(code, params));
|
||||
|
||||
return params ? data.getStock() : { ...DEFAULT_STOCK, code };
|
||||
return data.getStock();
|
||||
});
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user