前端到后台ThinkPHP開發整站(1)


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分了,不要熬夜容易長痘,今天先把表設計好,明天進行編碼!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM