Files
MBTI_wang/api/database/migrations/add_feishu_lead_webhook.sql
Ghost cf835ea585 feat: 管理端推送 Webhook 配置与出站推送链路接入
1、修复了管理端设置在推送开关/配置项上的联动与保存问题。

2、新增 OutboundPushHookService、PushHook/InternalPushHook 接口、前端 PushHookConfigPanel 与小程序 pushHook 工具。

3、优化 Analyze/Auth/Test/支付回调触发路径,补充去重迁移脚本与实施文档。

Made-with: Cursor
2026-04-15 15:07:36 +08:00

25 lines
1.6 KiB
SQL
Raw Permalink 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.

-- 多业务推送幂等去重表(前缀须与 .env DATABASE_PREFIX 一致,默认 mbti_
-- 若库中尚无此表,可任选其一:
-- 1在 api 目录执行php database/migrations/run_delivery_dedup.php自动读前缀建表
-- 2在数据库控制台执行本文件或按需把表名前缀改成你的 DATABASE_PREFIX
CREATE TABLE IF NOT EXISTS `mbti_delivery_dedup` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`scene` varchar(32) NOT NULL COMMENT '场景feishu_lead=飞书获客outbound_hook=通用出站 Webhook扩展时新增枚举值',
`dedupKey` varchar(255) NOT NULL COMMENT '该场景下幂等键(与 scene 联合唯一);出站场景为 envelope._dedupKey 原值,不含 push_hook: 前缀',
`createdAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_scene_dedup` (`scene`, `dedupKey`),
KEY `idx_scene` (`scene`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='多业务推送幂等去重(飞书获客、出站 Webhook 等共用)';
-- 若已从旧版建过 `mbti_feishu_lead_dedup`(仅 dedupKey 无 scene可迁移后删旧表执行前请备份
-- INSERT IGNORE INTO `mbti_delivery_dedup` (`scene`, `dedupKey`, `createdAt`)
-- SELECT
-- CASE WHEN `dedupKey` LIKE 'push_hook:%' THEN 'outbound_hook' ELSE 'feishu_lead' END,
-- CASE WHEN `dedupKey` LIKE 'push_hook:%' THEN SUBSTRING(`dedupKey`, 11) ELSE `dedupKey` END,
-- `createdAt`
-- FROM `mbti_feishu_lead_dedup`;
-- DROP TABLE `mbti_feishu_lead_dedup`;
-- 若旧表仅有 dedupKey 160 字符等,可先 ALTER 再迁移;或先建新表再 INSERT IGNORE 如上。