mirror of
https://ghfast.top/https://github.com/aeroxw/tick-stock-panel.git
synced 2026-09-12 17:54:15 +08:00
feat(ext-data): 新增扩展数据支持 URL 创建并调整设置弹窗 tab (#64)
- 新建扩展数据弹窗加入 URL/文件/手动 三种接入方式, URL 模式支持探测字段、预览、保存拉取配置并可选立即导入或定时拉取 - 后端新增 /api/ext-data/detect-url 探测接口, 自动识别 JSON 行数组路径、字段类型与 symbol/code 候选列 - 抽出 infer_fields_from_df / detect_symbol_candidates / apply_config_mapping 公共逻辑, 文件上传与 URL 探测复用 - 拉取写入支持仅含 code 的数据, 按 code_map 自动生成标准 symbol - 设置弹窗 tab 顺序调整为 拉取/推送/上传, 默认显示拉取
This commit is contained in:
@@ -133,9 +133,15 @@ async def fetch_and_ingest(
|
||||
# 字段映射
|
||||
rows = _apply_field_map(rows, pull.field_map)
|
||||
|
||||
# 校验 symbol 列
|
||||
if rows and "symbol" not in rows[0]:
|
||||
raise ValueError("数据行中缺少 symbol 字段,请配置 field_map 映射")
|
||||
# 校验可关联标的的字段:直接 symbol/code,或配置里声明的映射源列。
|
||||
row_keys = set(rows[0]) if rows else set()
|
||||
mapped_cols = {
|
||||
m.get("col")
|
||||
for m in (config.symbol_map or {}, config.code_map or {})
|
||||
if m.get("type") == "mapped" and m.get("col")
|
||||
}
|
||||
if rows and not ({"symbol", "code"} & row_keys or mapped_cols & row_keys):
|
||||
raise ValueError("数据行中缺少 symbol/code 字段,请配置字段映射或标的映射")
|
||||
|
||||
# 写入
|
||||
snap = date.today()
|
||||
|
||||
Reference in New Issue
Block a user