1、前言:
我个人从来没有写过博客文章,作为一个程序员没有自己的博客算是一个合格的程序员,所以我地想想也要经营起一个的博客,做一个小项目,写这博客算就做这个项目的一个项目笔记吧!现在自学着ThinkPHP,就借此框架做一个CMS系统。废话不多说了,赶紧进入学习了。
2、需求分析:
功能分析:
一、登录退出功能。
二、菜单功能:涉及前端菜单导航设置。
三、文章管理:文章编写,编辑插件掌握,异步图片上传。
四、推荐位管理:让用户自行设定首页推荐文章显示的设定。
五、用户管理:管理后台登录的用户和权限管理。
六、基本管理:也就是配置管理,用于修改操作网站的头部关键字,和设置是否进行生成缓存与是否自动备份数据库。
3、表设计:
CREATE DATABASE `tp_cms`;
CREATE TABLE `cms_admin`(
`admin_id` mediumint(6) unsigned NOT NULL AUTO_INCREMENT,
`user_name` varchar(20) not null default '' COMMENT '管理员ID',
`password` varchar(32) not null default '' COMMENT '密码',
`last_login_ip` varchar(15) default '0' COMMENT '最后登录IP',
`last_login_time` int(10) unsigned default '0' comment '最后登录时间',
`email` varchar(40) default '' comment '邮箱地址',
`real_name` varchar(50) not null default '' comment '真实姓名',
`status` tinyint(1) not null default '1' comment '状态',
primary key (`admin_id`),
key `user_name` (`user_name`)
)COMMENT='后台用户表' ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
create table `cms_menu` (
`menu_id` smallint(6) unsigned not null auto_increment comment '菜单ID',
`name` varchar(40) not null default '' comment '菜单名',
`parentid` smallint(6) not null default '0' comment '父级菜单',
`m` varchar(20) not null default '',
`c` varchar(20) not null default '',
`f` varchar(20) not null default '',
`listorder` smallint(6) unsigned not null default '0' comment '序号',
`status` tinyint(1) unsigned not null default '1' comment '状态',
`type` tinyint(1) unsigned not null default '0' comment '类型',
primary key (`menu_id`),
key `listorder` (`listorder`),
key `parentid` (`parentid`),
key `module` (`m`,`c`,`f`)
)COMMENT='菜单表' ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=UTF8;
create table `cms_news` (
`news_id` mediumint(8) unsigned not null auto_increment comment '新闻ID',
`catid` smallint(5) unsigned not null default '0' comment '栏目ID',
`title` varchar(80) not null default '标题',
`small_title` varchar(30) not null default '小标题',
`title_font_color` varchar(250) default null comment '标题颜色',
`thumb` varchar(100) not null default '' comment '主题',
`keywords` char(40) not null default '' comment '关键字',
`description` varchar(250) not null comment '文章描述',
`listorder` tinyint(3) unsigned not null default '0' comment '序号',
`status` tinyint(1) not null default '1' comment '状态',
`copyfrom` varchar(250) default null comment '文章来源',
`user_name` char(20) not null comment '用户',
`create_time` int(10) unsigned not null default '0' comment '创建时间',
`update_time` int(10) unsigned not null default '0' comment '更新时间',
`count` int(10) unsigned not null default '0' comment '总数',
primary key (`news_id`),
key `listorder`(`listorder`),
key `catid`(`catid`)
)COMMENT='新闻文章主表' ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=UTF8;
create table `cms_news_content`(
`id` mediumint(8) unsigned not null auto_increment comment 'Id',
`news_id` mediumint(8) unsigned not null comment '新闻ID',
`content` mediumtext not null comment '内容',
`create_time` int(10) unsigned not null default '0' comment '创建时间',
`update_time` int(10) unsigned not null default '0' comment '更新时间',
primary key (`id`),
key `news_id` (`news_id`)
)COMMENT='新闻文章内容副表' ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=UTF8;
create table `cms_position`(
`id` smallint(5) unsigned not null auto_increment comment 'id',
`name` char(30) not null default '' comment '名称',
`status` tinyint(1) not null default '1' comment '状态',
`description` char(100) default null comment '描述',
`create_time` int(10) unsigned not null default '0' comment '创建时间',
`update_time` int(10) unsigned not null default '0' comment '更新时间',
primary key (`id`)
)COMMENT='推荐位管理表' ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=UTF8;
create table `cms_position_content`(
`id` smallint(5) unsigned not null auto_increment comment 'id' comment 'id',
`positon_id` int(5) unsigned not null comment '推荐表ID',
`title` varchar(30) not null default '' comment '标题',
`thumb` varchar(100) not null default '' comment '主题',
`url` varchar(100) default null comment '地址',
`news_id` mediumint(8) unsigned not null comment '新闻ID',
`listorder` tinyint(3) unsigned not null default '0' comment '排序ID',
`status` tinyint(1) not null default '1' comment '状态',
`create_time` int(10) unsigned not null default '0' comment '创建时间',
`update_time` int(10) unsigned not null default '0' comment '更新时间',
primary key (`id`),
key `positon_id` (`positon_id`)
)COMMENT='推荐位内容表' ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=UTF8;
今天第一天写到这里,已经22点33分了,不要熬夜容易长痘,今天先把表设计好,明天进行编码!