发布(0.4.5): 修复重选号台账同步并移除强制确认
This commit is contained in:
@@ -223,6 +223,10 @@ def sync_platform_fulfillment_order(
|
||||
)
|
||||
order = order_by_no
|
||||
created = False
|
||||
was_platform_projection = (
|
||||
order is not None
|
||||
and order.source_type == SOURCE_TYPE_PLATFORM_FULFILLMENT
|
||||
)
|
||||
|
||||
now = _now()
|
||||
account = (
|
||||
@@ -232,6 +236,11 @@ def sync_platform_fulfillment_order(
|
||||
)
|
||||
gift_name, commodity_id, required_points = _platform_fulfillment_gift(db, task)
|
||||
home_images = _platform_fulfillment_home_images(task)
|
||||
account_changed = bool(
|
||||
account is not None
|
||||
and order is not None
|
||||
and int(order.account_id or 0) != int(account.id)
|
||||
)
|
||||
|
||||
if order is None:
|
||||
order = DouyuExternalOrder(
|
||||
@@ -266,17 +275,30 @@ def sync_platform_fulfillment_order(
|
||||
if home_images:
|
||||
order.home_images = home_images
|
||||
if account is not None and (
|
||||
created or (order.account_id is None and not order.account_username)
|
||||
created
|
||||
or was_platform_projection
|
||||
or (order.account_id is None and not order.account_username)
|
||||
):
|
||||
order.account_id = int(account.id)
|
||||
order.account_username = _text(account.username, max_length=128)
|
||||
order.account_uid = _text(account.uid, max_length=32)
|
||||
order.account_nickname = _text(account.nickname, max_length=128)
|
||||
if was_platform_projection and (
|
||||
account_changed
|
||||
or not task.bind_task_id
|
||||
or task.binding_status != "bound"
|
||||
):
|
||||
# 履约单重选号或重新进入绑定流程后,预售台账是平台账号的投影,
|
||||
# 不能继续展示首单/上一轮角色。
|
||||
order.bind_game_account = ""
|
||||
order.bind_game_role = ""
|
||||
order.bind_game_channel = ""
|
||||
order.bind_snapshot_at = None
|
||||
_apply_platform_fulfillment_binding(
|
||||
db,
|
||||
order,
|
||||
task,
|
||||
overwrite=created,
|
||||
overwrite=created or was_platform_projection,
|
||||
)
|
||||
_apply_platform_fulfillment_status(order, task, created=created)
|
||||
order.version = int(order.version or 0) + 1
|
||||
|
||||
Reference in New Issue
Block a user