From 093838babdad980edbb8534e6daabfb9cbb280e7 Mon Sep 17 00:00:00 2001 From: zhx Date: Sat, 11 Jul 2026 02:20:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=99=90=E5=AE=9A=20VIP=20=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E5=9B=9E=E5=A1=AB=E7=B4=A2=E5=BC=95=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/mysql/060_configurable_vip_program.sql | 5 ++++- scripts/mysql/061_vip_daily_coin_rebate.sql | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/mysql/060_configurable_vip_program.sql b/scripts/mysql/060_configurable_vip_program.sql index 36e4cf6d..fdb21f5a 100644 --- a/scripts/mysql/060_configurable_vip_program.sql +++ b/scripts/mysql/060_configurable_vip_program.sql @@ -96,12 +96,15 @@ EXECUTE stmt; DEALLOCATE PREPARE stmt; -- 历史成功命令必须在上线前进入同一守卫空间,否则升级后一段时间内仍可能走旧唯一键竞争路径。 +-- wallet_transactions 的业务索引以 app_code 为首列;这里显式限定当前已注册 App,避免生产迁移 +-- 因只按 biz_type 过滤退化为全表扫描。新 App 上线后的命令会直接经过运行时 command guard。 INSERT IGNORE INTO vip_command_locks ( app_code, command_id, biz_type, request_hash, created_at_ms, updated_at_ms ) SELECT app_code, command_id, biz_type, request_hash, created_at_ms, updated_at_ms FROM wallet_transactions -WHERE biz_type IN ('vip_purchase', 'vip_grant'); +WHERE app_code IN ('lalu', 'fami', 'huwaa', 'yumi') + AND biz_type IN ('vip_purchase', 'vip_grant'); INSERT IGNORE INTO vip_command_locks ( app_code, command_id, biz_type, request_hash, created_at_ms, updated_at_ms diff --git a/scripts/mysql/061_vip_daily_coin_rebate.sql b/scripts/mysql/061_vip_daily_coin_rebate.sql index 810f820c..3683e28b 100644 --- a/scripts/mysql/061_vip_daily_coin_rebate.sql +++ b/scripts/mysql/061_vip_daily_coin_rebate.sql @@ -67,9 +67,12 @@ SET execution_scope = 'notice' WHERE benefit_code = 'online_global_notice'; -- 已经先上线过领取交易的环境补齐统一 VIP command guard;同 command 不能再被购买、发卡或另一返现复用。 +-- 显式限定当前 App 才能使用 wallet_transactions 的 (app_code,biz_type,created_at_ms) 索引; +-- 禁止在生产迁移中只按 biz_type 扫描完整钱包交易表。 INSERT IGNORE INTO vip_command_locks ( app_code, command_id, biz_type, request_hash, created_at_ms, updated_at_ms ) SELECT app_code, command_id, biz_type, request_hash, created_at_ms, updated_at_ms FROM wallet_transactions -WHERE biz_type = 'vip_daily_coin_rebate'; +WHERE app_code IN ('lalu', 'fami', 'huwaa', 'yumi') + AND biz_type = 'vip_daily_coin_rebate';