feat: 添加关键字过滤功能并优化市场 slug 处理
主要变更: 1. 关键字过滤功能 - 添加关键字过滤模式(白名单/黑名单/禁用) - 支持关键字列表配置(JSON 存储) - 实现关键字匹配逻辑(不区分大小写) - 数据库迁移:V20__add_keyword_filter.sql 2. 市场 slug 优化 - 区分显示用 slug 和跳转用 eventSlug - 添加 event_slug 字段到 markets 表(V21__add_event_slug_to_markets.sql) - 从 events[0].slug 获取跳转用的 slug 并存入数据库 - 减少 API 请求,提高性能 3. UI 优化 - 将创建/编辑跟单配置改为 Modal 方式 - 删除独立的 CopyTradingAdd 和 CopyTradingEdit 页面 - 更新前端跳转逻辑,优先使用 eventSlug 4. API 响应优化 - 更新 MarketResponse 添加 events 字段 - 统一从 events[0].slug 获取跳转用的 slug - 更新所有相关服务使用新的 slug 获取逻辑
This commit is contained in:
@@ -98,7 +98,8 @@ export const isAutoGeneratedOrderId = (orderId: string | undefined | null): bool
|
||||
* 构建 Polymarket 市场 URL
|
||||
* 对于 moneyline 市场,跳转到 moneyline 页面
|
||||
* 注意:目前无法自动判断市场是否为 moneyline,需要后端提供标识
|
||||
* @param marketSlug - 市场 slug
|
||||
* @param marketSlug - 市场 slug(用于显示)
|
||||
* @param eventSlug - 跳转用的 slug(从 events[0].slug 获取,优先使用)
|
||||
* @param marketCategory - 市场分类(sports, crypto 等)
|
||||
* @param marketId - 市场ID(作为后备)
|
||||
* @param isMoneyline - 是否为 moneyline 市场(需要后端提供)
|
||||
@@ -106,18 +107,21 @@ export const isAutoGeneratedOrderId = (orderId: string | undefined | null): bool
|
||||
*/
|
||||
export const getPolymarketUrl = (
|
||||
marketSlug?: string | null,
|
||||
eventSlug?: string | null, // 跳转用的 slug(优先使用)
|
||||
_marketCategory?: string | null, // 保留参数以便未来使用
|
||||
marketId?: string | null,
|
||||
isMoneyline?: boolean
|
||||
): string | null => {
|
||||
// 优先使用 slug
|
||||
if (marketSlug) {
|
||||
// 优先使用 eventSlug(跳转用的 slug)
|
||||
const slug = eventSlug || marketSlug
|
||||
|
||||
if (slug) {
|
||||
// 如果是 moneyline 市场,跳转到 moneyline 页面
|
||||
if (isMoneyline === true) {
|
||||
return `https://polymarket.com/event/${marketSlug}/moneyline`
|
||||
return `https://polymarket.com/event/${slug}/moneyline`
|
||||
}
|
||||
// 其他市场跳转到普通市场页面
|
||||
return `https://polymarket.com/event/${marketSlug}`
|
||||
return `https://polymarket.com/event/${slug}`
|
||||
}
|
||||
|
||||
// 如果没有 slug,使用 marketId(作为后备)
|
||||
|
||||
Reference in New Issue
Block a user