feat(fulfillment): 接收并展示 order_site 客户主页截图
- 履约任务新增客户角色/平台/系统/主页截图/更新时间字段 - 迁移 0131 - order_site contractVersion=3 快照自动落客户资料 - 增加客户资料 integration 写入接口 - 工作台详情展示客户资料、平台角色比对和截图 - 补充客户资料保存/快照解析测试与对接文档
This commit is contained in:
@@ -521,6 +521,10 @@
|
||||
"20261124_0130_douyu_api_max_amount.py": {
|
||||
"revision": "20261124_0130",
|
||||
"sha256": "fcaa64dfa069084fd6636b459b53f670376c79adf765f41646f05b6829ee9885"
|
||||
},
|
||||
"20261124_0131_fulfillment_customer_profile.py": {
|
||||
"revision": "20261124_0131",
|
||||
"sha256": "23f8780eb16a689a5f929f3f1e1865e84c0896dbde70be6bbffb0ef77d06d587"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user