Files
MBTI_wang/api/database/migrations/add_mp_analytics_events.sql
Ghost 3317c84b5e feat: 管理端与用户端批量更新(订单/邀请双码/tabBar/审核与分销等)
- 管理端:用户详情、企业看板双小程序码、超管设置与用户列表等
- 后端:订单接口、邀请码企业版+个人版、分析与测试相关调整
- 微信小程序/抖音:自定义 tabBar 居中与拍摄钮上移、相机页与结果页、订单页、支付与统计
- 新增 faceResultDetail 工具与 mp 分析迁移脚本

Made-with: Cursor
2026-03-28 16:46:00 +08:00

26 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.

-- 小程序埋点表(与 mbti_ 表前缀一致;若 .env 中 DATABASE_PREFIX 不同,请同步改表名)
-- ThinkPHPDb::name('analytics_events') + 前缀 mbti_ => mbti_analytics_events
CREATE TABLE IF NOT EXISTS `mbti_analytics_events` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`userId` int(10) unsigned DEFAULT NULL COMMENT 'wechat_users.id / douyin_users.id',
`openid` varchar(64) DEFAULT NULL,
`eventName` varchar(128) NOT NULL DEFAULT '',
`pagePath` varchar(255) DEFAULT NULL,
`propsJson` text COMMENT 'JSON 字符串(含 _device/_network/_scene',
`clientTs` bigint(20) DEFAULT NULL COMMENT '客户端毫秒时间戳',
`platform` varchar(16) DEFAULT NULL COMMENT 'wechat / douyin',
`sessionId` varchar(64) DEFAULT NULL COMMENT '单次启动的会话标识',
`createdAt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_event_created` (`eventName`,`createdAt`),
KEY `idx_created` (`createdAt`),
KEY `idx_platform` (`platform`,`createdAt`),
KEY `idx_session` (`sessionId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='小程序行为埋点';
-- 若已有表需加列,执行以下 ALTER幂等写法
-- ALTER TABLE `mbti_analytics_events` ADD COLUMN `platform` varchar(16) DEFAULT NULL COMMENT 'wechat / douyin' AFTER `clientTs`;
-- ALTER TABLE `mbti_analytics_events` ADD COLUMN `sessionId` varchar(64) DEFAULT NULL COMMENT '单次启动的会话标识' AFTER `platform`;
-- ALTER TABLE `mbti_analytics_events` ADD INDEX `idx_platform` (`platform`,`createdAt`);
-- ALTER TABLE `mbti_analytics_events` ADD INDEX `idx_session` (`sessionId`);