fix: 修复记录时间

This commit is contained in:
橙子
2025-03-11 22:00:11 +08:00
parent 8ef91ebd03
commit 85ed4df1e4
3 changed files with 20 additions and 17 deletions

View File

@@ -303,8 +303,8 @@ const fetchStockPriceRecords = async () => {
// 计算时间范围: 今天的近5个小时
const now = dayjs();
const endTime = now.format('YYYY-MM-DD HH:00');
const startTime = now.subtract(5, 'hour').format('YYYY-MM-DD HH:00');
const endTime = now.format('YYYY-MM-DD HH:00:00');
const startTime = now.subtract(24, 'hour').format('YYYY-MM-DD HH:00:00');
// 获取当前选中股票的ID
// 注意这里假设stockList中的id就是后端的stockId如果不是需要调整
@@ -316,8 +316,7 @@ const fetchStockPriceRecords = async () => {
return;
}
// const { data } = await getStockPriceRecords(stockId, startTime, endTime);
const { data } = await getStockPriceRecords(stockId, '2025-03-08 21:00', '2025-03-09 21:00');
const { data } = await getStockPriceRecords(stockId, startTime, endTime);
// 将API返回的数据映射到图表所需的格式
stockChartData.value = (data.items || []).map(item => ({
date: dayjs(item.recordTime).format('MM-DD HH'),