88 lines
4.8 KiB
Python
88 lines
4.8 KiB
Python
"""任务深链(``goPath=rwfx`` / ``xdfx``)的「目的树闸门 + 行动→任务解析 + 跳转」配置。
|
||
|
||
前端(登录深链流程)通过公开只读接口 ``GET /api/public/config/task-deeplink``
|
||
读取这一段:所有外部地址都是**完整 URL**(调用时仅追加 ``?taskId=`` / ``?id=`` 或 ``/{actionId}`` 路径段),
|
||
随时改 ``config.yaml`` 即可(Gateway 有 mtime 热重载,无需重新构建前端)。
|
||
|
||
测试开关(线上接口未通时用假数据,互相独立):
|
||
- ``test`` → 目的树查询(``purpose_detail_url``)走 ``mock.purpose_detail`` 假数据;
|
||
同时 rwfx 进入「3q 是否完成」预检(``selectSqReport``,外部接口不可用)走 ``mock.sq_report`` 假数据。
|
||
- ``delete_test`` → 删除接口(``delete_url``)走 ``mock.delete`` 假数据(该接口尚未开发完时打开)。
|
||
rwfx 与 xdfx 共用同一个删除接口 ``dropSixOrSevenData``:rwfx 传 ``?taskId=``、xdfx 传 ``?actionId=``
|
||
(另一参数直接不传,不出现在 URL 里)。
|
||
- ``action_test`` → 行动详情接口(``action_detail_url``)走 ``mock.action_detail`` 假数据。
|
||
xdfx 深链传入的是「行动id」,需先调该接口拿 ``data.taskId`` 解析出真正的「任务id」。
|
||
|
||
``action_history_url`` 为 xdfx 删除前「行动历史是否存在」预检接口,地址待提供:留空则前端视作
|
||
「无历史/不查询」,不阻断删除(后续配上真实地址即生效)。
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
from typing import Any
|
||
|
||
from pydantic import BaseModel, ConfigDict, Field
|
||
|
||
|
||
class TaskDeeplinkConfig(BaseModel):
|
||
"""rwfx 任务深链的目的树查询 / 删除接口与跳转页地址。"""
|
||
|
||
model_config = ConfigDict(extra="allow")
|
||
|
||
test: bool = Field(
|
||
default=False,
|
||
description="为真时前端目的树查询走 mock.purpose_detail 假数据;同时 rwfx 进入「3q 是否完成」预检(selectSqReport)走 mock.sq_report 假数据(都不打真实接口)",
|
||
)
|
||
delete_test: bool = Field(
|
||
default=False,
|
||
description="为真时前端删除接口走 mock.delete 假数据(删除接口未开发完时打开)",
|
||
)
|
||
action_test: bool = Field(
|
||
default=False,
|
||
description="为真时前端「行动→任务」解析走 mock.action_detail 假数据(不打真实接口)",
|
||
)
|
||
cop_task_detail_test: bool = Field(
|
||
default=False,
|
||
description="为真时开放接口 POST /api/open/3qfx/ask 按 taskId 取任务详情走 mock.cop_task_detail 假数据(上游 consumer 不可达时用)",
|
||
)
|
||
cop_task_detail_url: str = Field(
|
||
default="",
|
||
description="任务详情接口完整 URL(开放接口 /api/open/3qfx/ask 后端按 taskId 拉取,追加 ?taskId=);与前端 cop-task-detail 同一上游。留空则该开放接口报 503。",
|
||
)
|
||
cop_task_detail_authorization: str = Field(
|
||
default="Bearer admin",
|
||
description="拉取任务详情时下发的 Authorization 头(与前端 axios 拦截器一致,默认 Bearer admin)",
|
||
)
|
||
purpose_detail_url: str = Field(
|
||
default="",
|
||
description="目的树查询完整 URL,调用时追加 ?taskId=",
|
||
)
|
||
action_detail_url: str = Field(
|
||
default="",
|
||
description="行动详情接口基址(xdfx 行动→任务),调用时追加 /{actionId} 路径段;返回 data.taskId 为真正任务id",
|
||
)
|
||
action_history_url: str = Field(
|
||
default="",
|
||
description="xdfx「行动历史是否存在」查询完整 URL(删除前预检),调用时追加 ?actionId=;地址待提供,留空则前端视作「无历史/不查询」(不阻断删除)",
|
||
)
|
||
detail_3q_url: str = Field(
|
||
default="",
|
||
description="「3q详情」详情页 URL(rwfx 目的树面板的链接),跳转时追加 ?id=(任务id)",
|
||
)
|
||
delete_url: str = Field(
|
||
default="",
|
||
description="删除完整 URL(rwfx 与 xdfx 共用同一个删除接口 dropSixOrSevenData):rwfx 调用追加 ?taskId=(不传 actionId),xdfx 调用追加 ?actionId=(不传 taskId)——另一参数直接不出现在 URL 里,不是空值",
|
||
)
|
||
treemap_edit_url: str = Field(
|
||
default="",
|
||
description="B 系统树形完整编辑页 URL,跳转时追加 ?id=",
|
||
)
|
||
treemap_next_url: str = Field(
|
||
default="",
|
||
description="B 系统树形下一步页 URL,跳转时追加 ?id=",
|
||
)
|
||
mock: dict[str, Any] = Field(
|
||
default_factory=dict,
|
||
description="test/delete_test/action_test 为真时返回的假数据:{purpose_detail: {...}, delete: {message, success}, action_detail: {state, msg, data: {taskId, ...}}, sq_report: {state, msg, data: [...]}}(sq_report 供 rwfx 3q 预检,test 为真时用)",
|
||
)
|