a3a14b484a
改了什么:新增京东联盟订单查询客户端、cps_order 京东字段迁移、CPS 对账接口 platform=all/jd、数据大盘京东订单与佣金聚合。 为什么改:数据大盘需要展示京东 CPS 真实订单佣金,不再保持占位。 验证方式:python -m pytest tests\\test_admin_read.py::test_dashboard_overview tests\\test_cps_admin.py::test_jd_reconcile_updates_dashboard -q;本地真实拉取 2026-06-27 京东订单 3 行,页面显示京东有效 1 单/佣金 ¥0.13。 --------- Co-authored-by: lowmaster-chen <1119780489@qq.com> Reviewed-on: #90 Co-authored-by: chenshuobo <chenshuobo@wonderable.ai> Co-committed-by: chenshuobo <chenshuobo@wonderable.ai>
57 lines
2.5 KiB
Python
57 lines
2.5 KiB
Python
"""add jd cps order fields
|
|
|
|
Revision ID: jd_cps_order_fields
|
|
Revises: 7db22acee504
|
|
Create Date: 2026-06-28 20:30:00.000000
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
revision = "jd_cps_order_fields"
|
|
down_revision = "7db22acee504"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
with op.batch_alter_table("cps_order") as batch_op:
|
|
batch_op.add_column(
|
|
sa.Column("platform", sa.String(length=20), nullable=False, server_default="meituan")
|
|
)
|
|
batch_op.add_column(sa.Column("external_order_id", sa.String(length=128), nullable=True))
|
|
batch_op.add_column(sa.Column("external_row_id", sa.String(length=128), nullable=True))
|
|
batch_op.add_column(sa.Column("estimated_commission_cents", sa.Integer(), nullable=True))
|
|
batch_op.add_column(sa.Column("actual_commission_cents", sa.Integer(), nullable=True))
|
|
batch_op.add_column(sa.Column("jd_valid_code", sa.String(length=16), nullable=True))
|
|
batch_op.add_column(sa.Column("settle_month", sa.String(length=16), nullable=True))
|
|
batch_op.add_column(sa.Column("site_id", sa.String(length=128), nullable=True))
|
|
batch_op.add_column(sa.Column("position_id", sa.String(length=128), nullable=True))
|
|
batch_op.add_column(sa.Column("pid", sa.String(length=128), nullable=True))
|
|
batch_op.add_column(sa.Column("sub_union_id", sa.String(length=128), nullable=True))
|
|
batch_op.create_index("ix_cps_order_platform", ["platform"])
|
|
batch_op.create_index("ix_cps_order_external_order_id", ["external_order_id"])
|
|
batch_op.create_index("ix_cps_order_external_row_id", ["external_row_id"])
|
|
batch_op.create_index("ix_cps_order_jd_valid_code", ["jd_valid_code"])
|
|
|
|
|
|
def downgrade() -> None:
|
|
with op.batch_alter_table("cps_order") as batch_op:
|
|
batch_op.drop_index("ix_cps_order_jd_valid_code")
|
|
batch_op.drop_index("ix_cps_order_external_row_id")
|
|
batch_op.drop_index("ix_cps_order_external_order_id")
|
|
batch_op.drop_index("ix_cps_order_platform")
|
|
batch_op.drop_column("sub_union_id")
|
|
batch_op.drop_column("pid")
|
|
batch_op.drop_column("position_id")
|
|
batch_op.drop_column("site_id")
|
|
batch_op.drop_column("settle_month")
|
|
batch_op.drop_column("jd_valid_code")
|
|
batch_op.drop_column("actual_commission_cents")
|
|
batch_op.drop_column("estimated_commission_cents")
|
|
batch_op.drop_column("external_row_id")
|
|
batch_op.drop_column("external_order_id")
|
|
batch_op.drop_column("platform")
|