fix: 修复 雪球类型股票代码转换统一码错误

This commit is contained in:
zhangxiangliang 2020-08-20 22:56:32 +08:00
parent e0e1d16ae3
commit 787f4fd95d

View File

@ -10,6 +10,7 @@ import fetch from "@utils/fetch";
import Stock from "types/utils/stock";
import StockApi from "types/stocks/index";
import Dictionary from "types/utils/dictionary";
import XueqiuApiCodeTransform from "./transforms/api-code";
let token: string = '';
@ -91,9 +92,8 @@ const Xueqiu: StockApi & { getToken(): Promise<string> } = {
const res = await fetch.get(url).set('Cookie', token);
const body = JSON.parse(res.text);
const rows: Dictionary<Dictionary<string | number>>[] = body.stocks;
const codes: string[] = (rows.map(i => String(i.code)));
const rows: Dictionary<string>[] = body.stocks;
const codes: string[] = rows.map(i => (new XueqiuApiCodeTransform).transform(i.code));
return await Xueqiu.getStocks(codes);
}
}