Files
ycc-proxy-server/deploy/sql/agent_config_migration.sql
2025-12-02 19:57:10 +08:00

57 lines
2.5 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- ============================================
-- 代理配置表重构 SQL 脚本
-- 执行顺序:按照下面的顺序依次执行
-- ============================================
-- ============================================
-- 步骤1删除价格相关配置项
-- 说明价格配置已改为在产品配置表agent_product_config中按产品配置
-- ============================================
DELETE FROM `agent_config` WHERE `config_key` IN (
'base_price',
'system_max_price',
'price_threshold',
'price_fee_rate'
);
-- ============================================
-- 步骤2统一配置键命名
-- 说明:修改配置键名称,使其与代码逻辑一致
-- ============================================
-- 修改等级加成配置键
UPDATE `agent_config` SET `config_key` = 'level_1_bonus' WHERE `config_key` = 'level_bonus_normal';
UPDATE `agent_config` SET `config_key` = 'level_2_bonus' WHERE `config_key` = 'level_bonus_gold';
UPDATE `agent_config` SET `config_key` = 'level_3_bonus' WHERE `config_key` = 'level_bonus_diamond';
-- 修改升级费用配置键
UPDATE `agent_config` SET `config_key` = 'upgrade_to_gold_fee' WHERE `config_key` = 'upgrade_fee_normal_to_gold';
UPDATE `agent_config` SET `config_key` = 'upgrade_to_diamond_fee' WHERE `config_key` = 'upgrade_fee_to_diamond';
-- 修改升级返佣配置键
UPDATE `agent_config` SET `config_key` = 'upgrade_to_gold_rebate' WHERE `config_key` = 'upgrade_rebate_normal_to_gold';
UPDATE `agent_config` SET `config_key` = 'upgrade_to_diamond_rebate' WHERE `config_key` = 'upgrade_rebate_to_diamond';
-- ============================================
-- 步骤3添加缺失的配置项
-- 说明:添加免税额度配置项(如果不存在)
-- ============================================
INSERT INTO `agent_config` (`config_key`, `config_value`, `config_type`, `description`)
SELECT 'tax_exemption_amount', '0.00', 'tax', '提现免税额度默认0'
WHERE NOT EXISTS (
SELECT 1 FROM `agent_config` WHERE `config_key` = 'tax_exemption_amount'
);
-- ============================================
-- 验证查询:检查配置项是否正确
-- ============================================
SELECT `config_key`, `config_value`, `config_type`, `description`
FROM `agent_config`
WHERE `del_state` = 0
ORDER BY `config_type`, `config_key`;
-- ============================================
-- 执行完成后,请重新生成 agent_config 相关的 Model 代码
-- ============================================