fix(HEL-494): 网站市场客户端改为纯中枢 Facade,并迁移 iFinD 凭据到中枢

生产 gateway 不再读取 Tushare token 或实例化 TushareProvider/TushareClient;问财凭据经带鉴权的中枢接口加密入库,避免发版后 iFinD 未配置。

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
总工
2026-09-08 23:37:53 +08:00
co-authored by Cursor multica-agent
parent 100752f43c
commit 8a7d1f3698
15 changed files with 235 additions and 83 deletions
+5
View File
@@ -76,6 +76,11 @@ class HubRequestHandler(BaseHTTPRequestHandler):
payload = self.hub.api.query_api(body)
self._json(payload, HTTPStatus.OK)
return
if path == "/v1/credentials/ifind" and method == "POST":
body = self._read_json()
payload = self.hub.put_ifind_credentials(body)
self._json(payload, HTTPStatus.OK)
return
payload = self.hub.api.handle(path, parse_query(query))
self._json(payload, HTTPStatus.OK)
+12
View File
@@ -1,6 +1,7 @@
from __future__ import annotations
from pathlib import Path
from typing import Any
from datahub.adapters.ifind import IfindAdapter
from datahub.adapters.tushare import TushareAdapter
@@ -52,6 +53,17 @@ class Hub:
self.admin = AdminAPI(self.db, self.pipeline, self.scheduler, self.auth, ifind=self.ifind)
self.static_dir = Path(__file__).resolve().parents[1] / "admin"
def put_ifind_credentials(self, body: dict[str, Any] | None) -> dict[str, Any]:
from datahub.serving import envelope
payload = dict(body or {})
refresh = str(payload.get("ifind_refresh_token") or "").strip()
access = str(payload.get("ifind_access_token") or "").strip()
self.auth.store_credential("ifind_refresh_token", refresh)
self.auth.store_credential("ifind_access_token", access)
self.ifind.set_credentials(refresh, access)
return envelope(self.ifind.status(), {"source": "ifind"})
def start(self) -> None:
if self.settings.scheduler_enabled:
self.scheduler.start()