install.sql 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. CREATE TABLE IF NOT EXISTS `__PREFIX__cms_category` (
  2. `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT '栏目ID',
  3. `catname` varchar(30) NOT NULL DEFAULT '' COMMENT '栏目名称',
  4. `catdir` varchar(30) NOT NULL DEFAULT '' COMMENT '唯一标识',
  5. `type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '类别',
  6. `target` varchar(20) NOT NULL DEFAULT '_self' COMMENT '打开方式',
  7. `modelid` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '模型ID',
  8. `parentid` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '父ID',
  9. `arrparentid` varchar(255) NOT NULL DEFAULT '' COMMENT '所有父ID',
  10. `arrchildid` mediumtext COMMENT '所有子栏目ID',
  11. `child` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否存在子栏目,1存在',
  12. `image` varchar(255) NOT NULL DEFAULT '' COMMENT '栏目图片',
  13. `icon` varchar(255) NOT NULL DEFAULT '' COMMENT '栏目图标',
  14. `description` mediumtext NOT NULL COMMENT '栏目描述',
  15. `url` varchar(100) NOT NULL DEFAULT '' COMMENT '链接地址',
  16. `items` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '文档数量',
  17. `setting` text COMMENT '相关配置信息',
  18. `listorder` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  19. `status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '状态',
  20. PRIMARY KEY (`id`),
  21. UNIQUE KEY `catdir` (`catdir`),
  22. KEY `parentid` (`parentid`)
  23. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT='栏目表';
  24. CREATE TABLE IF NOT EXISTS `__PREFIX__cms_category_priv` (
  25. `catid` smallint(5) unsigned NOT NULL DEFAULT '0',
  26. `roleid` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '角色或者组ID',
  27. `is_admin` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否为管理员 1、管理员',
  28. `action` varchar(30) NOT NULL DEFAULT '' COMMENT '动作',
  29. KEY `catid` (`catid`,`roleid`,`is_admin`,`action`)
  30. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT='栏目权限表';
  31. CREATE TABLE IF NOT EXISTS `__PREFIX__cms_page` (
  32. `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  33. `catid` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '栏目ID',
  34. `title` varchar(160) NOT NULL DEFAULT '' COMMENT '标题',
  35. `keywords` varchar(255) NOT NULL DEFAULT '' COMMENT '关键字',
  36. `description` varchar(255) NOT NULL DEFAULT '' COMMENT 'SEO描述',
  37. `content` text COMMENT '内容',
  38. `thumb` varchar(255) NOT NULL DEFAULT '' COMMENT '缩略图',
  39. `hits` mediumint(8) unsigned DEFAULT '0' COMMENT '点击量',
  40. `publish_time` int(10) unsigned DEFAULT NULL COMMENT '发布时间',
  41. `create_time` int(10) unsigned DEFAULT NULL COMMENT '创建时间',
  42. `update_time` int(10) unsigned DEFAULT NULL COMMENT '更新时间',
  43. PRIMARY KEY (`id`)
  44. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT='单页内容表';
  45. CREATE TABLE IF NOT EXISTS `__PREFIX__cms_tags` (
  46. `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT 'tagID',
  47. `tag` varchar(20) NOT NULL DEFAULT '' COMMENT 'tag名称',
  48. `seo_title` varchar(255) NOT NULL DEFAULT '' COMMENT 'seo标题',
  49. `seo_keyword` varchar(255) NOT NULL DEFAULT '' COMMENT 'seo关键字',
  50. `seo_description` varchar(255) NOT NULL DEFAULT '' COMMENT 'seo简介',
  51. `usetimes` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '信息总数',
  52. `hits` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '点击数',
  53. `create_time` int(10) unsigned DEFAULT NULL COMMENT '添加时间',
  54. `update_time` int(10) unsigned DEFAULT NULL COMMENT '更新时间',
  55. `listorder` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  56. PRIMARY KEY (`id`),
  57. UNIQUE KEY `tag` (`tag`),
  58. KEY `usetimes` (`usetimes`,`listorder`),
  59. KEY `hits` (`hits`,`listorder`)
  60. ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT='tags主表';
  61. CREATE TABLE IF NOT EXISTS `__PREFIX__cms_tags_content` (
  62. `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  63. `tag_id` int(10) DEFAULT NULL COMMENT '标签ID',
  64. `content_id` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '信息ID',
  65. `catid` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '栏目ID',
  66. `update_time` int(10) unsigned DEFAULT NULL COMMENT '更新时间',
  67. PRIMARY KEY (`id`)
  68. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT='tags数据表';
  69. CREATE TABLE IF NOT EXISTS `__PREFIX__cms_order` (
  70. `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  71. `trade_sn` varchar(50) DEFAULT '' COMMENT '订单ID',
  72. `user_id` int(10) unsigned DEFAULT '0' COMMENT '会员ID',
  73. `content_id` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '信息ID',
  74. `catid` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '栏目ID',
  75. `title` varchar(100) DEFAULT NULL COMMENT '订单标题',
  76. `type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '1金钱or2点数',
  77. `total_price` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '订单总价',
  78. `pay_price` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际支付金额',
  79. `pay_type` varchar(50) DEFAULT NULL COMMENT '支付类型',
  80. `method` varchar(100) NULL DEFAULT '' COMMENT '支付方法',
  81. `ip` varchar(50) DEFAULT NULL COMMENT 'IP地址',
  82. `useragent` varchar(255) DEFAULT NULL COMMENT '用户访问端标识',
  83. `remark` varchar(255) NOT NULL COMMENT '备注说明',
  84. `pay_time` int(10) unsigned DEFAULT NULL COMMENT '支付时间',
  85. `create_time` int(10) unsigned DEFAULT NULL COMMENT '添加时间',
  86. `update_time` int(10) unsigned DEFAULT NULL COMMENT '更新时间',
  87. `status` enum('succ','cancel','unpay') NOT NULL DEFAULT 'unpay' COMMENT '状态',
  88. PRIMARY KEY (`id`),
  89. KEY `catid` (`catid`,`content_id`),
  90. KEY `trade_sn` (`trade_sn`)
  91. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT='订单表';
  92. CREATE TABLE IF NOT EXISTS `__PREFIX__cms_content` (
  93. `id` int(10) NOT NULL AUTO_INCREMENT,
  94. `catid` smallint(5) NOT NULL COMMENT '栏目ID',
  95. `content_id` int(10) NOT NULL COMMENT '信息ID',
  96. `user_id` mediumint(8) NOT NULL COMMENT '会员ID',
  97. `username` varchar(16) NOT NULL COMMENT '用户名',
  98. `create_time` int(10) unsigned DEFAULT NULL COMMENT '添加时间',
  99. `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态',
  100. PRIMARY KEY (`id`),
  101. KEY `user_id` (`catid`,`content_id`,`status`)
  102. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT='会员投稿信息记录表';
  103. CREATE TABLE `__PREFIX__cms_model` (
  104. `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  105. `module` varchar(15) NOT NULL DEFAULT '' COMMENT '所属模块',
  106. `name` varchar(30) NOT NULL DEFAULT '' COMMENT '模型名称',
  107. `tablename` varchar(20) NOT NULL DEFAULT '' COMMENT '表名',
  108. `description` varchar(100) NOT NULL DEFAULT '' COMMENT '描述',
  109. `setting` text NOT NULL COMMENT '配置信息',
  110. `type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '模型类别:1-独立表,2-主附表',
  111. `create_time` int(10) unsigned DEFAULT NULL COMMENT '添加时间',
  112. `update_time` int(10) unsigned DEFAULT NULL COMMENT '更新时间',
  113. `listorder` tinyint(3) NOT NULL DEFAULT '0' COMMENT '排序',
  114. `status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '状态',
  115. PRIMARY KEY (`id`)
  116. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT='模型列表';
  117. CREATE TABLE `__PREFIX__cms_field` (
  118. `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  119. `modelid` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '模型ID',
  120. `name` varchar(20) NOT NULL DEFAULT '' COMMENT '字段名',
  121. `title` varchar(30) NOT NULL DEFAULT '' COMMENT '别名',
  122. `remark` tinytext NULL COMMENT '字段提示',
  123. `pattern` varchar(255) NOT NULL DEFAULT '' COMMENT '数据校验正则',
  124. `errortips` varchar(255) NOT NULL DEFAULT '' COMMENT '数据校验未通过的提示信息',
  125. `type` varchar(20) NOT NULL DEFAULT '' COMMENT '字段类型',
  126. `extend` varchar(255) DEFAULT '' COMMENT '扩展信息',
  127. `setting` mediumtext NULL COMMENT '字段配置',
  128. `ifsystem` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否主表字段 1 是',
  129. `iscore` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否内部字段',
  130. `iffixed` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否固定不可修改',
  131. `ifrequire` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否必填',
  132. `ifsearch` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '作为搜索条件',
  133. `isadd` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '在投稿中显示',
  134. `isorder` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否排序',
  135. `create_time` int(10) unsigned DEFAULT NULL COMMENT '创建时间',
  136. `update_time` int(10) unsigned DEFAULT NULL COMMENT '更新时间',
  137. `listorder` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  138. `status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '状态',
  139. PRIMARY KEY (`id`),
  140. KEY `name` (`name`,`modelid`)
  141. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT='模型字段列表';
  142. -- 2.2.1 --
  143. ALTER TABLE `__PREFIX__cms_category`
  144. ADD COLUMN `target` varchar(20) NOT NULL DEFAULT '_self' COMMENT '打开方式' AFTER `type`;