Files
zyt/server/database/migrations/create_fan_tables.sql
2026-03-14 11:16:04 +08:00

41 lines
2.2 KiB
SQL

-- 粉丝表
CREATE TABLE IF NOT EXISTS `zyt_fan` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '姓名',
`phone` varchar(20) NOT NULL DEFAULT '' COMMENT '手机号',
`id_card` varchar(18) NOT NULL DEFAULT '' COMMENT '身份证号码',
`age` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT '年龄',
`gender` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT '性别: 0=未知 1=男 2=女',
`remark` varchar(500) NOT NULL DEFAULT '' COMMENT '备注',
`creator_id` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '创建人ID',
`creator_name` varchar(50) NOT NULL DEFAULT '' COMMENT '创建人名称',
`status` tinyint(1) unsigned NOT NULL DEFAULT 1 COMMENT '状态: 0=禁用 1=启用',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(10) unsigned DEFAULT NULL COMMENT '修改时间',
`delete_time` int(10) unsigned DEFAULT NULL COMMENT '删除时间',
PRIMARY KEY (`id`),
KEY `idx_phone` (`phone`),
KEY `idx_id_card` (`id_card`),
KEY `idx_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='粉丝表';
-- 粉丝回访记录表
CREATE TABLE IF NOT EXISTS `zyt_fan_visit_record` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`fan_id` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '关联粉丝ID',
`visit_type` tinyint(1) unsigned NOT NULL DEFAULT 1 COMMENT '回访类型: 1=电话 2=微信 3=短信 4=上门 5=其他',
`visit_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '回访时间',
`content` text COMMENT '回访内容',
`result` varchar(500) NOT NULL DEFAULT '' COMMENT '回访结果',
`next_visit_time` int(10) unsigned DEFAULT NULL COMMENT '下次回访时间',
`operator_id` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '操作人ID',
`operator_name` varchar(50) NOT NULL DEFAULT '' COMMENT '操作人名称',
`create_time` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_time` int(10) unsigned DEFAULT NULL COMMENT '修改时间',
`delete_time` int(10) unsigned DEFAULT NULL COMMENT '删除时间',
PRIMARY KEY (`id`),
KEY `idx_fan_id` (`fan_id`),
KEY `idx_visit_time` (`visit_time`),
KEY `idx_operator_id` (`operator_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='粉丝回访记录表';