feat(push-notifications): 新增挑战提醒定时推送功能
新增每日定时推送系统,根据用户参与状态发送不同类型的挑战提醒: - 已参与用户:每日发送鼓励推送 - 未参与用户:隔天发送挑战邀请 - 匿名用户:隔天发送通用邀请 包含推送历史记录表、定时任务调度、多类型文案模板和防重复发送机制
This commit is contained in:
16
sql-scripts/push-reminder-history-table-create.sql
Normal file
16
sql-scripts/push-reminder-history-table-create.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
-- 创建推送提醒历史记录表
|
||||
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='推送提醒历史记录表';
|
||||
Reference in New Issue
Block a user