feat(fulfillment): 接收并展示 order_site 客户主页截图

- 履约任务新增客户角色/平台/系统/主页截图/更新时间字段
- 迁移 0131
- order_site contractVersion=3 快照自动落客户资料
- 增加客户资料 integration 写入接口
- 工作台详情展示客户资料、平台角色比对和截图
- 补充客户资料保存/快照解析测试与对接文档
This commit is contained in:
yml
2026-11-24 21:25:14 +08:00
parent 06a226f51f
commit 6ec8248068
14 changed files with 531 additions and 2 deletions
@@ -0,0 +1,64 @@
"""直播账号履约保存 order_site 客户资料与主页截图。
客户领取页改为必填主页截图;order_site 通过 integration API 推送到 live-hub,
履约工作台直接展示并和绑定角色比对,不再由客服手动索要。
"""
from __future__ import annotations
import sqlalchemy as sa
from alembic import op
revision: str = "20261124_0131"
down_revision: str | None = "20261124_0130"
branch_labels: str | None = None
depends_on: str | None = None
TABLE = "platform_fulfillment_tasks"
COLUMNS = {
"customer_role_name": sa.String(length=128),
"customer_platform": sa.String(length=16),
"customer_system": sa.String(length=16),
"customer_home_images": sa.JSON(),
"customer_profile_updated_at": sa.DateTime(),
}
def _column_exists(name: str) -> bool:
conn = op.get_bind()
count = conn.execute(
sa.text(
"SELECT COUNT(*) FROM information_schema.columns "
"WHERE table_schema = DATABASE() AND table_name = :table "
"AND column_name = :name"
),
{"table": TABLE, "name": name},
).scalar()
return bool(count)
def upgrade() -> None:
text_columns = {
"customer_role_name",
"customer_platform",
"customer_system",
}
for name, column_type in COLUMNS.items():
if _column_exists(name):
continue
op.add_column(
TABLE,
sa.Column(
name,
column_type,
nullable=name not in text_columns,
server_default="" if name in text_columns else None,
),
)
def downgrade() -> None:
for name in reversed(tuple(COLUMNS)):
if _column_exists(name):
op.drop_column(TABLE, name)