Files
cai-server/doc/20251128.sql
2025-12-05 15:18:46 +08:00

88 lines
5.0 KiB
SQL

alter table cai_account
add column `points` bigint(20) default 0 not null comment '积分';
ALTER TABLE cai_goods
ADD COLUMN `give_point` bigint(20) default 0 not null comment '充值赠送积分';
ALTER TABLE cai_recharge_order
ADD COLUMN `distribution` tinyint default 0 not null comment '是否參與分銷';
CREATE TABLE `cai_account_delete` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '子账户ID',
`user_id` bigint unsigned NOT NULL COMMENT '用户ID',
`usercode` varchar(10) NOT NULL COMMENT '用户Code',
`mobile` varchar(50) COMMENT '手机',
`invite_id` bigint unsigned DEFAULT NULL COMMENT '邀请人',
`coin` bigint NOT NULL DEFAULT '0' COMMENT '当前彩币数量',
`income_coin` bigint NOT NULL DEFAULT '0' COMMENT '收益的彩币数量',
`total_buy_money` decimal(20,2) NOT NULL DEFAULT '0.00' COMMENT '充值总额',
`total_buy_coin` bigint NOT NULL DEFAULT '0' COMMENT '充值彩贝总额',
`total_trd_money` decimal(20,2) NOT NULL DEFAULT '0.00' COMMENT '三方充值总额',
`message_income_coin` bigint NOT NULL DEFAULT '0' COMMENT '聊天收入',
`video_income_coin` bigint NOT NULL DEFAULT '0' COMMENT '视频收入',
`gift_income_coin` bigint NOT NULL DEFAULT '0' COMMENT '礼物收入',
`guard_income_coin` bigint NOT NULL DEFAULT '0' COMMENT '守护收入',
`union_income_coin` bigint NOT NULL DEFAULT '0' COMMENT '工会收入',
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '账户锁定 0 正常 1 锁定',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`anchor_total_coin` bigint DEFAULT '0' COMMENT '主播总收入',
`points` bigint NOT NULL DEFAULT '0' COMMENT '积分',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='用户账户备份';
ALTER TABLE cai_user_info
ADD COLUMN point_rate decimal(7, 2) default 0.00 not null comment '积分分销比例';
ALTER TABLE cai_recharge_order
ADD COLUMN `give_point` bigint(20) default 0 not null comment '充值赠送积分';
CREATE TABLE `cai_point_record_log`
(
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`points` bigint(20) DEFAULT 0 COMMENT '积分',
`source_user_id` bigint(20) COMMENT '消费方用户',
`source_usercode` varchar(20) COMMENT '消费方用户',
`source_phone` varchar(50) COMMENT '消费方用户',
`one_user_id` bigint(20) COMMENT '分销方',
`one_usercode` varchar(20) COMMENT '分销方',
`one_phone` varchar(50) COMMENT '分销方',
`one_rate` decimal(8, 2) COMMENT '分销方提成比例',
`one_points` bigint(20) COMMENT '分销方积分',
`status` tinyint default 0 comment '状态 -1-无须分销 0-待分销 1-已分销',
`source_type` varchar(20) comment '来源',
`source_id` varchar(20) comment '来源ID',
`remark` varchar(255) comment '备注',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_date` (`source_user_id`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 1
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci
ROW_FORMAT = DYNAMIC COMMENT ='用户积分分销';
-- 菜单 SQL
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible,
status, perms, icon, create_by, create_time, update_by, update_time, remark)
values (1996050872055914497, '用户积分分销', '1741377069687037954', '1', 'pointRecordLog', 'cai/pointRecordLog/index',
1, 0, 'C', '0', '0', 'cai:pointRecordLog:list', '#', 'admin', sysdate(), '', null, '用户积分分销菜单');
-- 按钮 SQL
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible,
status, perms, icon, create_by, create_time, update_by, update_time, remark)
values (1996050872055914498, '用户积分分销查询', 1996050872055914497, '1', '#', '', 1, 0, 'F', '0', '0',
'cai:pointRecordLog:query', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible,
status, perms, icon, create_by, create_time, update_by, update_time, remark)
values (1996050872055914500, '用户积分分销修改', 1996050872055914497, '3', '#', '', 1, 0, 'F', '0', '0',
'cai:pointRecordLog:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible,
status, perms, icon, create_by, create_time, update_by, update_time, remark)
values (1996050872055914501, '用户积分分销删除', 1996050872055914497, '4', '#', '', 1, 0, 'F', '0', '0',
'cai:pointRecordLog:remove', '#', 'admin', sysdate(), '', null, '');