feat(whale-monitor): 保存策略时落库缓存市场并回显标题

- 创建/更新策略时复用 MarketService.getMarkets 写入 markets 表缓存
- 策略 DTO 增加 markets 字段,编辑页直接用其显示市场标题

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
WrBug
2026-05-27 05:19:27 +08:00
co-authored by Cursor
parent 5d6f0e03f6
commit 1d47cf0451
5 changed files with 101 additions and 6 deletions
+21
View File
@@ -30,6 +30,27 @@ export function conditionIdsToMarkets(
})
}
/** 策略列表/详情中的 markets 字段转为表单展示项 */
export function strategyMarketsToItems(
markets: Array<{
conditionId: string
title: string
slug?: string
category?: string
image?: string
icon?: string
}>
): WhaleMonitorMarketItem[] {
return markets.map(m => ({
conditionId: m.conditionId,
title: m.title,
slug: m.slug,
category: m.category,
image: m.image,
icon: m.icon
}))
}
/** 解析 Gamma 返回的 outcomes JSON 字符串 */
export function parseMarketOutcomes(outcomes?: string): string[] {
if (!outcomes?.trim()) return []