|
@@ -82,51 +82,6 @@ export class StockDataService extends GenericCrudService<StockData> {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取股票备忘录数据
|
|
|
|
|
- * @param code 股票代码
|
|
|
|
|
- * @returns 股票备忘录列表
|
|
|
|
|
- */
|
|
|
|
|
- async getStockMemos(code?: string): Promise<Array<{
|
|
|
|
|
- date: string;
|
|
|
|
|
- memo: string;
|
|
|
|
|
- [key: string]: string;
|
|
|
|
|
- }>> {
|
|
|
|
|
- try {
|
|
|
|
|
- if (!code) {
|
|
|
|
|
- return [];
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const notes = await this.repository.manager.query(`
|
|
|
|
|
- SELECT
|
|
|
|
|
- note_date as date,
|
|
|
|
|
- note as memo
|
|
|
|
|
- FROM date_notes
|
|
|
|
|
- WHERE code = ?
|
|
|
|
|
- ORDER BY note_date ASC
|
|
|
|
|
- `, [code]);
|
|
|
|
|
-
|
|
|
|
|
- if (!notes || notes.length === 0) {
|
|
|
|
|
- return [];
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 转换数据格式
|
|
|
|
|
- const formattedNotes = notes.map((note: any) => ({
|
|
|
|
|
- date: dayjs(note.date).format('YYYY-MM-DD'),
|
|
|
|
|
- memo: note.memo,
|
|
|
|
|
- 日期: dayjs(note.date).format('YYYY-MM-DD'),
|
|
|
|
|
- 提示: note.memo
|
|
|
|
|
- }));
|
|
|
|
|
-
|
|
|
|
|
- log.db(`Retrieved ${formattedNotes.length} memos for ${code}`);
|
|
|
|
|
- return formattedNotes;
|
|
|
|
|
-
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- log.db('Error fetching memo data:', error);
|
|
|
|
|
- throw error;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取股票最新数据
|
|
* 获取股票最新数据
|
|
|
* @param code 股票代码
|
|
* @param code 股票代码
|