6432497af1
提现申请改为先扣款并进入待审核,审核通过后才发起微信打款,审核拒绝或微信失败时自动退款。 新增运营后台提现列表的关键词搜索、日期筛选、快捷筛选和排序参数,并支持批量通过、批量拒绝、批量刷新查单。 新增微信支付配置健康检查、现金账本校验、自动对账 worker 和单实例保护。 新增数据库唯一索引,约束同一用户未完成提现和同一提现单重复退款,提升并发安全性。 --------- Co-authored-by: OuYingJun1024 <1034284404@qq.com> Reviewed-on: #27 Co-authored-by: ouzhou <ouzhou@wonderable.ai> Co-committed-by: ouzhou <ouzhou@wonderable.ai>
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
"""add withdraw concurrency safety indexes
|
|
|
|
Revision ID: withdraw_safety_indexes
|
|
Revises: 0cf18d590b1d
|
|
Create Date: 2026-06-08 16:20:00.000000
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = "withdraw_safety_indexes"
|
|
down_revision: Union[str, Sequence[str], None] = "0cf18d590b1d"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_index(
|
|
"ux_withdraw_order_user_active",
|
|
"withdraw_order",
|
|
["user_id"],
|
|
unique=True,
|
|
sqlite_where=sa.text("status IN ('reviewing', 'pending')"),
|
|
postgresql_where=sa.text("status IN ('reviewing', 'pending')"),
|
|
)
|
|
op.create_index(
|
|
"ux_cash_transaction_withdraw_refund_ref",
|
|
"cash_transaction",
|
|
["ref_id"],
|
|
unique=True,
|
|
sqlite_where=sa.text("biz_type = 'withdraw_refund' AND ref_id IS NOT NULL"),
|
|
postgresql_where=sa.text("biz_type = 'withdraw_refund' AND ref_id IS NOT NULL"),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ux_cash_transaction_withdraw_refund_ref", table_name="cash_transaction")
|
|
op.drop_index("ux_withdraw_order_user_active", table_name="withdraw_order")
|