Skip to content

Commit

Permalink
fix: 多余hk的数据
Browse files Browse the repository at this point in the history
  • Loading branch information
giscafer committed Oct 13, 2024
1 parent c27c0b4 commit bbd7300
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/shared/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ const Log = {
log,
};

export default Log
export default Log;
12 changes: 6 additions & 6 deletions src/shared/tencentStock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export const searchStockList = async (keyword: string) => {
q: keyword,
},
});
Log.info('stockResponse: ', stockResponse.data);
// Log.info('stockResponse: ', stockResponse.data);
const stockListArray = stockResponse?.data?.data?.stock || [];
Log.info('stockListStr: ', stockListArray, keyword);
// Log.info('stockListStr: ', stockListArray, keyword);
const stockList = stockListArray.map((stockItemArr: string[]) => {
return {
code: stockItemArr[1].toLowerCase(),
Expand All @@ -27,7 +27,7 @@ export const searchStockList = async (keyword: string) => {
};

export const getTencentHKStockData = async (codes: string[]) => {
Log.info('getStockData codes: ', codes);
// Log.info('before getStockData codes: ', codes);
const stockDataResponse = await Axios.get(stockDataUrl, {
responseType: 'arraybuffer',
transformResponse: [
Expand All @@ -40,8 +40,8 @@ export const getTencentHKStockData = async (codes: string[]) => {
q: codes.join(','),
},
});
Log.info('stockDataResponse: ', stockDataResponse.data);
const stockDataList = (stockDataResponse.data || '').split(';').map((stockItemStr: string) => {
// Log.info('stockDataResponse: ', stockDataResponse.data);
const stockDataList = (stockDataResponse.data || '').split(';').slice(0,codes.length).map((stockItemStr: string) => {
const stockItemArr = stockItemStr.split('~');
return {
code: 'hk' + stockItemArr[2],
Expand All @@ -58,6 +58,6 @@ export const getTencentHKStockData = async (codes: string[]) => {
time: stockItemArr[30],
};
});
Log.info('stockDataList: ', stockDataList, codes);
// Log.info('stockDataList: ', stockDataList, codes);
return stockDataList;
};

0 comments on commit bbd7300

Please sign in to comment.