feat(whale-monitor): 市场选择改为弹窗并优化列表交互

- 策略编辑内嵌市场选择弹窗,移除路由跳转与 sessionStorage 草稿
- 列表区固定高度内部滚动,底部仅保留一处确认操作
- 并发缓存 markets 时捕获唯一键冲突并回读已有记录

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
WrBug
2026-05-27 05:31:50 +08:00
co-authored by Cursor
parent 1d47cf0451
commit a70ee3e811
3 changed files with 484 additions and 75 deletions
@@ -11,6 +11,7 @@ import com.wrbug.polymarketbot.util.getEventSlug
import com.wrbug.polymarketbot.util.parseStringArray
import kotlinx.coroutines.runBlocking
import org.slf4j.LoggerFactory
import org.springframework.dao.DataIntegrityViolationException
import org.springframework.stereotype.Service
import java.time.Instant
import java.time.format.DateTimeFormatter
@@ -205,9 +206,20 @@ class MarketService(
)
}
val savedMarket = marketRepository.save(market)
marketCache.put(marketId, savedMarket)
savedMarket
try {
val savedMarket = marketRepository.save(market)
marketCache.put(marketId, savedMarket)
savedMarket
} catch (e: DataIntegrityViolationException) {
// 并发写入同一个 marketId 时可能触发唯一索引冲突,这里降级为查询并返回已有记录
val existingAfter = marketRepository.findByMarketId(marketId)
if (existingAfter != null) {
marketCache.put(marketId, existingAfter)
existingAfter
} else {
throw e
}
}
} catch (e: Exception) {
logger.error("保存市场信息失败: marketId=$marketId, error=${e.message}", e)
null