增加自媒体渠道

This commit is contained in:
2026-04-23 15:43:22 +08:00
parent 366b005d78
commit 54431cbeb1
19 changed files with 737 additions and 47 deletions
@@ -0,0 +1,27 @@
CREATE TABLE IF NOT EXISTS `zyt_qywx_media_channel` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`channel_code` varchar(80) NOT NULL DEFAULT '' COMMENT '渠道编码:由 tag_id 或 tag_name 生成',
`channel_name` varchar(100) NOT NULL DEFAULT '' COMMENT '渠道名称(展示名)',
`source_tag_id` varchar(64) NOT NULL DEFAULT '' COMMENT '企微标签ID',
`source_tag_name` varchar(100) NOT NULL DEFAULT '' COMMENT '企微标签名',
`source_group_name` varchar(100) NOT NULL DEFAULT '' COMMENT '企微标签组名',
`tag_uniq_key` varchar(120) NOT NULL DEFAULT '' COMMENT '标签唯一键:优先 tag_id,否则 tag_name 哈希',
`status` tinyint(1) unsigned NOT NULL DEFAULT 1 COMMENT '状态:1=启用',
`last_seen_time` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '最近扫描命中时间',
`create_time` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_channel_code` (`channel_code`),
UNIQUE KEY `uk_tag_uniq_key` (`tag_uniq_key`),
KEY `idx_status` (`status`),
KEY `idx_last_seen_time` (`last_seen_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='企微渠道标签源表';
ALTER TABLE `zyt_account_cost`
ADD COLUMN `media_channel_code` varchar(80) NOT NULL DEFAULT '' COMMENT '渠道编码' AFTER `cost_date`,
ADD COLUMN `media_channel_name` varchar(100) NOT NULL DEFAULT '' COMMENT '渠道名称' AFTER `media_channel_code`;
ALTER TABLE `zyt_account_cost`
DROP INDEX `uk_cost_date`,
ADD UNIQUE KEY `uk_cost_date_channel` (`cost_date`, `media_channel_code`),
ADD KEY `idx_cost_date_channel` (`cost_date`, `media_channel_code`);