fix:自动补货更新

This commit is contained in:
2026-11-02 18:30:51 +08:00
parent ce8d99ad95
commit 4dbec33dbd
9 changed files with 197 additions and 20 deletions
@@ -0,0 +1,13 @@
-- 自动补货冷却独立计时:手动采购不再重置自动冷却
ALTER TABLE rock_configs ADD COLUMN IF NOT EXISTS last_auto_attempt_at TIMESTAMPTZ;
-- 保守回填:沿用最近一次采购尝试时间,上线后仍需等待一个冷却周期
UPDATE rock_configs
SET last_auto_attempt_at = COALESCE(last_attempt_at, last_purchased_at)
WHERE last_auto_attempt_at IS NULL;
-- 清理历史“冷却中”的空转流水(这些记录没有调用过上游,也没有阶段明细)
DELETE FROM rock_purchase_logs
WHERE status = 'skipped'
AND trigger_type = 'auto'
AND error_message LIKE '%冷却中%';