install.sql 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. CREATE TABLE IF NOT EXISTS `__PREFIX__yexam_ads` (
  2. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  3. `title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标题',
  4. `image` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '封面图',
  5. `weigh` int(11) NOT NULL DEFAULT 0 COMMENT '权重',
  6. `createtime` int(11) NOT NULL COMMENT '添加时间',
  7. PRIMARY KEY (`id`) USING BTREE
  8. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '轮播图';
  9. CREATE TABLE IF NOT EXISTS `__PREFIX__yexam_answers` (
  10. `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  11. `question_id` int(11) UNSIGNED NOT NULL COMMENT '题目ID',
  12. `answer_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '答案编号',
  13. `answer` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '答案',
  14. PRIMARY KEY (`id`) USING BTREE
  15. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '答案表';
  16. CREATE TABLE IF NOT EXISTS `__PREFIX__yexam_exam` (
  17. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  18. `subject_id` int(11) NOT NULL DEFAULT 0 COMMENT '科目ID',
  19. `type` enum('1','2') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '1正式考试 2模拟试题',
  20. `exam_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '考试名称',
  21. `question_ids` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '题目ID集合',
  22. `num` int(11) NOT NULL DEFAULT 0 COMMENT '题目数量',
  23. `score` int(11) NOT NULL DEFAULT 0 COMMENT '总分数',
  24. `start_date` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  25. `end_date` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
  26. `givetime` int(11) NOT NULL DEFAULT 0 COMMENT '答题时长(分钟)',
  27. `createtime` int(11) NOT NULL COMMENT '创建时间',
  28. `status` int(11) NOT NULL DEFAULT 1 COMMENT '1显示 0不显示',
  29. `sort` int(11) NOT NULL DEFAULT 0,
  30. PRIMARY KEY (`id`) USING BTREE
  31. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '测验表';
  32. CREATE TABLE IF NOT EXISTS `__PREFIX__yexam_exam_config` (
  33. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  34. `exam_id` int(11) NOT NULL COMMENT '测验ID',
  35. `type` int(11) NOT NULL COMMENT '题目类型',
  36. `score` decimal(10, 1) NOT NULL COMMENT '分数',
  37. `num` int(11) NOT NULL COMMENT '数量',
  38. PRIMARY KEY (`id`) USING BTREE
  39. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '测验配置表';
  40. CREATE TABLE IF NOT EXISTS `__PREFIX__yexam_exam_user` (
  41. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  42. `subject_id` int(11) NOT NULL DEFAULT 0 COMMENT '科目id',
  43. `exam_id` int(11) NOT NULL DEFAULT 0 COMMENT '测验ID',
  44. `type` int(11) NOT NULL COMMENT '1正式 2模拟',
  45. `user_id` int(11) NOT NULL DEFAULT 0 COMMENT '学员ID',
  46. `exam_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '考试名字',
  47. `begintime` int(11) NOT NULL DEFAULT 0 COMMENT '开始答题时间',
  48. `up_time` int(11) NOT NULL DEFAULT 0 COMMENT '交卷时间',
  49. `total_scode` int(11) NOT NULL DEFAULT 0 COMMENT '总分',
  50. `score` int(11) NOT NULL DEFAULT 0 COMMENT '实际得分',
  51. `up_status` int(11) NOT NULL DEFAULT 1 COMMENT '是否交卷 1否 2是',
  52. `endtime` int(11) NOT NULL DEFAULT 0 COMMENT '过期时间',
  53. `question_ids` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'id集合',
  54. PRIMARY KEY (`id`) USING BTREE,
  55. INDEX `user_id`(`user_id`) USING BTREE
  56. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '测验答题表';
  57. CREATE TABLE IF NOT EXISTS `__PREFIX__yexam_exam_user_log` (
  58. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  59. `exam_id` int(11) NOT NULL COMMENT '测验ID',
  60. `user_id` int(11) NOT NULL COMMENT '学员ID',
  61. `question_id` int(11) NOT NULL COMMENT '问题ID',
  62. `user_answer` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '学员答案',
  63. `lasttime` int(11) NOT NULL COMMENT '最后提交时间',
  64. `state` int(11) NOT NULL COMMENT '答题状态 0错误 1成功',
  65. `exam_user_id` int(11) NOT NULL DEFAULT 0,
  66. `score` int(11) NOT NULL DEFAULT 0,
  67. PRIMARY KEY (`id`) USING BTREE,
  68. INDEX `user_id`(`user_id`) USING BTREE,
  69. INDEX `question_id`(`question_id`) USING BTREE,
  70. INDEX `exam_user_id`(`exam_user_id`) USING BTREE,
  71. INDEX `state`(`state`) USING BTREE,
  72. INDEX `exam_user_id_2`(`exam_user_id`) USING BTREE
  73. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '测验答题详细记录表';
  74. CREATE TABLE IF NOT EXISTS `__PREFIX__yexam_fav` (
  75. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  76. `user_id` int(11) NOT NULL COMMENT '学员ID',
  77. `subject_id` int(11) NOT NULL COMMENT '科目id',
  78. `library_id` int(11) NOT NULL COMMENT '题库ID',
  79. `unit_id` int(11) NOT NULL COMMENT '章节ID',
  80. `question_id` int(11) NOT NULL COMMENT '题目id',
  81. `createtime` int(11) NOT NULL COMMENT '收藏时间',
  82. PRIMARY KEY (`id`) USING BTREE
  83. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '收藏表';
  84. CREATE TABLE IF NOT EXISTS `__PREFIX__yexam_library` (
  85. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  86. `library_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '题库名称',
  87. `subject_id` int(11) NOT NULL COMMENT '科目ID',
  88. `question_ids` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
  89. `num` int(11) NOT NULL DEFAULT 0,
  90. `createtime` int(11) NOT NULL COMMENT '创建时间',
  91. `weigh` int(11) NOT NULL DEFAULT 0,
  92. `status` int(11) NOT NULL DEFAULT 1 COMMENT '1显示 0隐藏',
  93. PRIMARY KEY (`id`) USING BTREE
  94. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '题库表';
  95. CREATE TABLE IF NOT EXISTS `__PREFIX__yexam_question` (
  96. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  97. `question_name` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '题目名称',
  98. `subject_id` int(11) NOT NULL DEFAULT 0 COMMENT '科目ID',
  99. `library_id` int(11) NOT NULL DEFAULT 0,
  100. `unit_id` int(11) NOT NULL DEFAULT 0 COMMENT '章节ID',
  101. `type` enum('1','2','3') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '题目类型 1单选 2多选 3判断',
  102. `right_answer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '正确答案',
  103. `area` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '备注/解析',
  104. PRIMARY KEY (`id`) USING BTREE,
  105. INDEX `subject_id`(`subject_id`) USING BTREE,
  106. INDEX `unit_id`(`unit_id`) USING BTREE,
  107. INDEX `id`(`id`) USING BTREE
  108. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '题目表';
  109. CREATE TABLE IF NOT EXISTS `__PREFIX__yexam_question_log` (
  110. `id` int(11) NOT NULL AUTO_INCREMENT,
  111. `user_id` int(11) NOT NULL DEFAULT 0 COMMENT '用户uid',
  112. `subject_id` int(11) NOT NULL DEFAULT 0 COMMENT '科目id',
  113. `unit_id` int(11) NOT NULL DEFAULT 0 COMMENT '章节id',
  114. `library_id` int(11) NOT NULL DEFAULT 0 COMMENT '题库id',
  115. `question_id` int(11) NOT NULL DEFAULT 0 COMMENT '题目id',
  116. `state` tinyint(4) NOT NULL COMMENT '答题状态:1正确 0错误',
  117. `createtime` int(11) NOT NULL DEFAULT 0 COMMENT '添加时间',
  118. `lasttime` int(11) NOT NULL,
  119. `error_num` int(11) NOT NULL DEFAULT 0 COMMENT '错误记录',
  120. `total_num` int(11) NOT NULL DEFAULT 0 COMMENT '答题总记录',
  121. PRIMARY KEY (`id`) USING BTREE,
  122. UNIQUE INDEX `id`(`id`) USING BTREE
  123. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '题库记录';
  124. CREATE TABLE IF NOT EXISTS `__PREFIX__yexam_subject` (
  125. `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  126. `subject_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '科目名称',
  127. `status` int(11) NOT NULL DEFAULT 1 COMMENT '1显示 0不显示',
  128. `weigh` int(11) NOT NULL DEFAULT 0 COMMENT '排序',
  129. `createtime` int(11) NOT NULL COMMENT '创建时间',
  130. PRIMARY KEY (`id`) USING BTREE
  131. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '科目表';
  132. CREATE TABLE IF NOT EXISTS `__PREFIX__yexam_unit` (
  133. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  134. `pid` int(11) NOT NULL DEFAULT 0 COMMENT '上级章节ID',
  135. `subject_id` int(11) NOT NULL COMMENT '科目ID',
  136. `unit_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '章节名称',
  137. `is_last` int(11) NOT NULL DEFAULT 1 COMMENT '是否为终极章节 1是 0否',
  138. `status` int(11) NOT NULL DEFAULT 1 COMMENT '1 显示 0隐藏',
  139. `createtime` int(11) NOT NULL COMMENT '创建时间',
  140. `sort` int(11) NOT NULL DEFAULT 0,
  141. PRIMARY KEY (`id`) USING BTREE
  142. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '章节表';
  143. CREATE TABLE `__PREFIX__yexam_third` (
  144. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  145. `user_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '会员ID',
  146. `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '来源',
  147. `openid` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'openID',
  148. `nickname` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '会员昵称',
  149. `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '头像',
  150. `createtime` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '创建时间',
  151. `updatetime` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '更新时间',
  152. PRIMARY KEY (`id`) USING BTREE,
  153. UNIQUE INDEX `platform`(`openid`) USING BTREE,
  154. INDEX `user_id`(`user_id`) USING BTREE
  155. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '第三方登录表';