Files
junhong_cmp_fiber/migrations/archive/000104_polling_config_data.up.sql

35 lines
1.8 KiB
SQL
Raw 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.
-- 任务 1.7:新增停机卡轮询配置
-- 停机卡需要持续轮询以检测复机条件(套餐购买、流量重置、实名完成)
-- priority=25 介于 not_real_name(10) 和 real_name(20) 之间
-- realname_check_interval 必须设置:停机且未实名的卡需要实名检查,实名完成后自动复机
INSERT INTO tb_polling_config (
config_name, card_condition, card_category, carrier_id,
priority, realname_check_interval, carddata_check_interval, package_check_interval, protect_check_interval,
status, description, created_at, updated_at
) VALUES (
'停机卡轮询', 'suspended', NULL, NULL,
25, 3600, 3600, 3600, NULL,
1, '停机卡每小时检查实名/流量/套餐,满足条件时自动复机', NOW(), NOW()
)
ON CONFLICT DO NOTHING;
-- 任务 1.8:为已激活在线卡配置添加保护期检查间隔
-- protect_check_interval 由迁移 000102 添加,但存量配置均为 NULL导致 protect 任务从未入队
UPDATE tb_polling_config
SET protect_check_interval = 3600, updated_at = NOW()
WHERE card_condition = 'activated' AND protect_check_interval IS NULL;
-- 同步为停机卡配置添加保护期检查(新增配置天然包含,此处保险更新)
UPDATE tb_polling_config
SET protect_check_interval = 3600, updated_at = NOW()
WHERE card_condition = 'suspended' AND protect_check_interval IS NULL;
-- 任务 1.9:将 card_condition='real_name' 的配置迁移到 'activated'
-- getCardCondition 修复后不再返回 real_name只返回 not_real_name/activated/suspended
-- real_name 配置将永远无法匹配,需迁移到 activated
UPDATE tb_polling_config
SET card_condition = 'activated',
description = COALESCE(description, '') || '(原 real_name 条件,已迁移至 activated',
updated_at = NOW()
WHERE card_condition = 'real_name';