Files
plates-server/sql-scripts/push-reminder-history-table-create.sql
richarjiang 37cc2a729b feat(push-notifications): 新增挑战提醒定时推送功能
新增每日定时推送系统,根据用户参与状态发送不同类型的挑战提醒:
- 已参与用户:每日发送鼓励推送
- 未参与用户:隔天发送挑战邀请
- 匿名用户:隔天发送通用邀请

包含推送历史记录表、定时任务调度、多类型文案模板和防重复发送机制
2025-11-03 17:49:14 +08:00

16 lines
1.0 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.

-- 创建推送提醒历史记录表
CREATE TABLE `t_push_reminder_history` (
`id` char(36) NOT NULL DEFAULT (UUID()),
`user_id` varchar(64) DEFAULT NULL COMMENT '用户ID可能为空',
`device_token` varchar(255) NOT NULL COMMENT '设备推送令牌',
`reminder_type` enum('challenge_encouragement','challenge_invitation','general_invitation') NOT NULL COMMENT '提醒类型',
`last_sent_at` datetime NOT NULL COMMENT '最后发送时间',
`sent_count` int NOT NULL DEFAULT '0' COMMENT '发送次数',
`next_available_at` datetime DEFAULT NULL COMMENT '下次可发送时间',
`is_active` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否激活',
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_user_device_type` (`user_id`,`device_token`,`reminder_type`),
KEY `idx_last_sent_at` (`last_sent_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='推送提醒历史记录表';