USE `yami_bbc`;
ALTER TABLE `tz_order`
    ADD COLUMN `room_id` bigint NULL DEFAULT NULL COMMENT '直播间id' AFTER `is_bind_voucher`;

CREATE TABLE `tz_live_room_data` (
                                     `room_data_id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '直播间数据表id',
                                     `room_id` bigint(20) unsigned zerofill DEFAULT NULL COMMENT '直播间id',
                                     `message_sum` tinyint DEFAULT '0' COMMENT '留言数',
                                     `order_sum` tinyint DEFAULT '0' COMMENT '订单总数',
                                     `order_money` decimal(15,2) DEFAULT NULL COMMENT '订单总金额数',
                                     `pay_order_money` decimal(15,2) DEFAULT NULL COMMENT '已付款总金额数',
                                     `create_time` datetime DEFAULT CURRENT_TIMESTAMP,
                                     `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                                     PRIMARY KEY (`room_data_id`),
                                     KEY `idx_room_id` (`room_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='直播间数据表';

ALTER TABLE `tz_live_room`
    ADD COLUMN `server_url` varchar(500) NULL COMMENT '服务器域名' AFTER `remark`,
    ADD COLUMN `push_code` varchar(500) NULL COMMENT '推流码' AFTER `server_url`;

INSERT INTO `tz_shop_menu`(`menu_id`, `parent_id`, `url`, `perms`, `type`, `icon`, `order_num`, `hidden`) VALUES
                          (771, 4, '/marketing/live-room/data', '', 1, '', 5, 1),
                          (772, 42, '', 'live:liveRoom:liveData', 2, '', 0, 0),
                          (773, 42, '', 'live:liveRoom:explain', 2, '', 0, 0);


INSERT INTO `tz_shop_menu_lang`(`menu_id`, `lang`, `name`) VALUES
                            (771, 0, '直播间数据'),
                            (771, 1, 'Live room data'),
                            (772, 0, '直播数据'),
                            (772, 1, 'Live Data'),
                            (773, 0, '商品讲解'),
                            (773, 1, 'Explain');



# 添加定时任务
USE `xxl_job`;
INSERT INTO `xxl_job_info`(`job_group`, `job_desc`, `add_time`, `update_time`, `author`, `alarm_email`, `schedule_type`, `schedule_conf`, `misfire_strategy`, `executor_route_strategy`, `executor_handler`, `executor_param`, `executor_block_strategy`, `executor_timeout`, `executor_fail_retry_count`, `glue_type`, `glue_source`, `glue_remark`, `glue_updatetime`, `child_jobid`, `trigger_status`, `trigger_last_time`, `trigger_next_time`) VALUES
    (2, '实时推送直播间数据', '2024-09-12 11:35:50', '2024-09-13 15:05:53', 'admin', '', 'CRON', '0/3 * * * * ?', 'DO_NOTHING', 'FIRST', 'pushLiveRoomData', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化', '2024-09-12 11:35:50', '', 1, 1727074836000, 1727074839000),
    (2, '每分钟更新直播间状态：到了开播时间，更新为直播中，到了直播结束时间，更新为已结束', '2024-09-14 09:26:03', '2024-09-18 09:23:38', 'admin', '', 'CRON', '0 * * * * ?', 'DO_NOTHING', 'FIRST', 'changeLiveCoomStatus', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化', '2024-09-14 09:26:03', '', 1, 1727074800000, 1727074860000);
