feat: 实现订单超时自动取消功能,支持钱包余额解冻和 Asynq Scheduler 统一调度
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m58s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m58s
- 新增 expires_at 字段和复合索引,待支付订单 30 分钟超时自动取消 - 实现 cancelOrder/unfreezeWalletForCancel 钱包余额解冻逻辑 - 创建 Asynq 定时任务(order_expire/alert_check/data_cleanup) - 将原有 time.Ticker 轮询迁移至 Asynq Scheduler 统一调度 - 同步 delta specs 到 main specs 并归档变更
This commit is contained in:
22
migrations/000069_add_order_expiration.down.sql
Normal file
22
migrations/000069_add_order_expiration.down.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
-- 回滚:删除订单过期时间索引和字段
|
||||
DO $$
|
||||
BEGIN
|
||||
-- 删除复合索引
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM pg_indexes
|
||||
WHERE tablename='tb_order'
|
||||
AND indexname='idx_order_expires'
|
||||
) THEN
|
||||
DROP INDEX idx_order_expires;
|
||||
END IF;
|
||||
|
||||
-- 删除 expires_at 字段
|
||||
IF EXISTS (
|
||||
SELECT 1 FROM information_schema.columns
|
||||
WHERE table_name='tb_order'
|
||||
AND column_name='expires_at'
|
||||
) THEN
|
||||
ALTER TABLE tb_order DROP COLUMN expires_at;
|
||||
END IF;
|
||||
END
|
||||
$$;
|
||||
Reference in New Issue
Block a user