-- ============================================
-- 联赛配置表 la_league
-- 来源: 懂球帝 API /data/tab/list 接口
-- ============================================

DROP TABLE IF EXISTS `la_league`;

CREATE TABLE `la_league` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `tab_id` int NOT NULL DEFAULT 0 COMMENT '懂球帝 tab ID（原始 id）',
  `league_id` int NOT NULL DEFAULT 0 COMMENT '懂球帝联赛 ID',
  `label` varchar(50) NOT NULL DEFAULT '' COMMENT '联赛显示名称',
  `type` varchar(50) NOT NULL DEFAULT '' COMMENT '类型标识: league/important/lottery',
  `sport_type` tinyint unsigned NOT NULL DEFAULT 1 COMMENT '运动类型: 1=足球 2=篮球 3=网球 4=电竞 5=综合',
  `api` varchar(500) NOT NULL DEFAULT '' COMMENT '懂球帝 API 地址',
  `icon` varchar(500) NOT NULL DEFAULT '' COMMENT '联赛图标 URL',
  `sort` int NOT NULL DEFAULT 0 COMMENT '排序权重（越小越靠前）',
  `is_show` tinyint unsigned NOT NULL DEFAULT 1 COMMENT '是否显示: 0=隐藏 1=显示',
  `extra_data` json DEFAULT NULL COMMENT '额外数据（如 calendar 等）',
  `create_time` int unsigned NOT NULL DEFAULT 0 COMMENT '创建时间',
  `update_time` int unsigned NOT NULL DEFAULT 0 COMMENT '更新时间',
  `delete_time` int unsigned DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_tab_id` (`tab_id`),
  KEY `idx_league_id` (`league_id`),
  KEY `idx_type` (`type`),
  KEY `idx_sort` (`sort`),
  KEY `idx_sport_type` (`sport_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='联赛配置表';


-- ============================================
-- 插入数据
-- ============================================

INSERT INTO `la_league` (`tab_id`, `league_id`, `label`, `type`, `sport_type`, `api`, `sort`, `is_show`, `extra_data`, `create_time`, `update_time`) VALUES
-- === 聚合分类 ===
(10,  0,    '重要',     'important', 5, 'https://api.dongqiudi.com/data/tab/new/important',   278, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(12,  0,    '全球',     'lottery',   5, 'https://api.dongqiudi.com/data/tab/new/lottery',      279, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(70,  0,    '足球',     'important', 1, 'https://api.dongqiudi.com/data/tab/new/soccer',       281, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(69,  0,    '篮球',     'important', 2, 'https://api.dongqiudi.com/data/tab/new/basketball',   282, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(107, 0,    '网球',     'important', 3, 'https://api.dongqiudi.com/data/tab/new/tennis',       283, 1, '{"calendar":{"icon":"https://img1.dongqiudi.com/fastdfs7/M00/35/44/rBUC6GhrdLGANtZqAAAmY4Lwmkg879.png","scheme":"dongqiudi:///url/https://topic.dongqiudi.com/webapp/tennisCalendar/tennisCalendar.html"}}', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(65,  0,    '电竞',     'important', 4, 'https://api.dongqiudi.com/data/tab/new/esport',       284, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(106, 0,    '体坛',     'important', 5, 'https://api.dongqiudi.com/data/tab/new/sport',        285, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),

-- === 足球联赛 ===
(5,   43,   '中超',     'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/43',    286, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(6,   4,    '英超',     'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/4',     287, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(8,   5,    '德甲',     'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/5',     288, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(7,   3,    '西甲',     'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/3',     289, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(9,   9,    '意甲',     'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/9',     290, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(30,  12,   '法甲',     'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/12',    291, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(31,  6,    '欧冠',     'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/6',     292, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(34,  14,   '欧联',     'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/14',    293, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(84,  3904, '欧协联',   'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/3904',  294, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(105, 226,  '亚冠精英', 'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/226',   297, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(98,  257,  '澳超',     'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/257',   298, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(99,  197,  '沙特联',   'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/197',   299, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(100, 129,  '中甲',     'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/129',   300, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(101, 1535, '中乙',     'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/1535',  301, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(111, 258,  '世俱杯',   'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/258',   302, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(113, 9930, '川超',     'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/9930',  303, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(118, 10225,'滇超',     'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/10225', 304, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(112, 8647, '苏超',     'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/8647',  305, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(115, 8817, '赣超',     'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/8817',  306, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(114, 9640, '湘超',     'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/9640',  307, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(116, 9576, '内蒙超',   'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/9576',  308, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(117, 9687, '齐鲁超',   'league', 1, 'https://api.dongqiudi.com/data/tab/league/new/9687',  309, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),

-- === 篮球联赛 ===
(68,  3010, 'NBA',      'league', 2, 'https://api.dongqiudi.com/data/tab/league/new/3010',  295, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()),
(67,  3027, 'CBA',      'league', 2, 'https://api.dongqiudi.com/data/tab/league/new/3027',  296, 1, NULL, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());
