Files
fast/add.sql
xiadc 349841a8a1 feat(zy): 添加访客记录功能
- 新增 zy_visitor 表,用于记录访客信息
- 调整签到活动逻辑,暂时注释掉活动状态检查
2025-06-28 21:42:42 +08:00

68 lines
3.7 KiB
SQL
Raw 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.

ALTER TABLE `zy_club` ADD COLUMN `intro` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '介绍' AFTER `blurb`;
ALTER TABLE `zy_club` ADD COLUMN `contect` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系方式' AFTER `img`;
ALTER TABLE `zy_club` ADD COLUMN `attention` int(11) NOT NULL DEFAULT 0 COMMENT '关注人数' AFTER `contect`;
-- 已执行 2025-05-18
ALTER TABLE `zy_circle` ADD COLUMN `top` int NOT NULL DEFAULT 0 COMMENT '置顶' AFTER `status`;
-- 已执行 2025-05-31
CREATE TABLE `zy_sign_record` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '用户id',
`date` date NOT NULL DEFAULT current_timestamp() COMMENT '签到日期',
`last` int(11) NOT NULL DEFAULT 1 COMMENT '已持续天数',
`create_time` datetime NOT NULL DEFAULT current_timestamp() COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE,
KEY `user_id` (`user_id`,`last`) USING BTREE,
KEY `date` (`date`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='签到记录';
CREATE TABLE `zy_sign_set` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`last` tinyint(4) NOT NULL DEFAULT 1 COMMENT '连续天数',
`chance1` tinyint(4) NOT NULL DEFAULT 0 COMMENT '概率1',
`coupon1_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '券1',
`chance2` tinyint(4) NOT NULL DEFAULT 0 COMMENT '概率2',
`coupon2_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '券2',
`create_time` datetime NOT NULL DEFAULT current_timestamp() COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE,
KEY `type` (`last`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='签到设置';
ALTER TABLE `zy_sign_set`
ADD COLUMN `status` tinyint NOT NULL DEFAULT 0 COMMENT '状态0禁用1启用' AFTER `coupon2_id`;
DROP TABLE IF EXISTS `zy_sign`;
-- 已执行 2025-06-16
ALTER TABLE `zy_sign_record`
ADD COLUMN `remark` varchar(255) NOT NULL DEFAULT '' COMMENT '获得礼物备注' AFTER `last`;
ALTER TABLE `zy_sign_set`
ADD COLUMN `name` varchar(255) NOT NULL DEFAULT '' COMMENT '名称' AFTER `status`,
ADD COLUMN `begin_date` date NULL DEFAULT NULL COMMENT '有效期开始' AFTER `name`,
ADD COLUMN `end_date` date NULL DEFAULT NULL COMMENT '有效期结束' AFTER `begin_date`,
ADD COLUMN `intro` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '说明' AFTER `end_date`;
-- 已执行 2025-06-17
CREATE TABLE `zy_visitor` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '类型0俱乐部/1球馆/2用户',
`obj_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '对象id',
`user_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '用户id',
`nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '昵称',
`avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '头像',
`gender` tinyint(4) NOT NULL DEFAULT 0 COMMENT '性别0女1男',
`times` int(11) NOT NULL DEFAULT 0 COMMENT '次数',
`create_time` datetime NOT NULL DEFAULT current_timestamp() COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE,
KEY `type` (`type`) USING BTREE,
KEY `obj_id` (`obj_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='标签';
-- 已执行 2025-06-28