前言
問什么想要寫這樣的一個博客
- 原有的WordPress無法為我的Android開發(fā)提供全面的接口畜眨,自定義程度較低堕花。
- 已學Java祈噪,正在接觸web開發(fā),期望有項目可以練手壮韭。
- 喜歡用自己的東西北发,不太喜歡抄襲和復用別人的項目。
- 記錄我遇到的難題喷屋。
- 對技術的熱愛&閑
很早之前就再接觸博客琳拨,而自己的興趣也比較廣泛,很多方面的東西都有接觸屯曹,當然網(wǎng)站也是很早就接觸過了狱庇,也對網(wǎng)站有很多的執(zhí)念,他不需要像Android軟件那樣需要安裝才能使用恶耽,不需要像小程序那樣只限定在某一個軟件里面才能打開密任,也不需要像windows/linux那樣限制在某一個平臺。對于一個網(wǎng)站偷俭,只有設備有網(wǎng)絡浪讳,有瀏覽器就可訪問你的網(wǎng)站。而且對于你的網(wǎng)站社搅,你的更新可以不受用戶的限制驻债,不需要用戶操作就可更新迭代,這全部由開發(fā)者自己決定形葬。當然網(wǎng)站還有最重要的一點合呐,就是可定制性高,需要什么功能自己實現(xiàn)即可笙以。
于是淌实,我決定自己動手寫一個博客。
手寫一個博客你能學到什么
- Springboot
- Spring data Jpa / Mybatis
- redis
- shiro
- mysql
- Maven
- angular(不保證你能學到什么,前端部分一團糟)
以此來作為一個springboot的入門級項目也是不錯的拆祈,邊敲代碼邊學習恨闪。能夠?qū)W習到不少的東西,但是用到的這些東西并不是該項技術的全部放坏,望周知咙咽。
如果你有springboot的項目經(jīng)驗,以此來串聯(lián)起各個方面的知識也是不錯的淤年。
需求
前臺展示頁面
- 首頁展示文章钧敞,標簽,以及簡單的個人信息
- 有標簽和分類的單獨頁面麸粮。
- 有用戶系統(tǒng)
- 用戶可以進行留言和評論溉苛。
- 網(wǎng)站的更新記錄
后臺展示頁面
- 文章管理
- 文章撰寫(Markdown格式)
- 標簽,分類管理
- 留言弄诲,評論管理
- 友鏈愚战,網(wǎng)站更新記錄的管理
- 用戶管理
- 訪客詳情
部署
前后端分離部署
前端 :nginx 靜態(tài)部署
后端:java - jar xxx & 后臺運行任務
設計
后端用到的技術
技術 | 名稱 |
---|---|
項目框架 | Springboot |
orm | mybatis |
分頁 | PageHelper |
緩存 | redis |
項目構建 | maven |
權限管理框架 | shiro |
數(shù)據(jù)庫 | mysql 5.7 |
數(shù)據(jù)庫連接池 | alibaba druid |
開發(fā)環(huán)境 | IDEA |
運行環(huán)境 | Ubuntu 16.04 |
圖床 | 七牛云 |
前端用到的技術
技術 | 名稱 |
---|---|
項目框架 | angular 8.0 |
markdown解析 | <span>Editor.md</span> |
ui庫 | Ant Design |
數(shù)據(jù)庫
CREATE DATABASE `blog`;
USE blog;
CREATE TABLE `article`
(
`a_id` bigint(20) primary key auto_increment,
`a_title` varchar(255) not null comment '文章標題',
`a_summary` varchar(255) not null comment '文章摘要',
`a_md_content` longtext not null comment '文章Markdown內(nèi)容',
`a_tags_id` varchar(255) not null comment '標簽id \',\'處于最尾端',
`a_category_id` bigint(20) not null comment '分類的id',
`a_url` tinytext default null comment '轉(zhuǎn)載文章的原文鏈接',
`a_author_id` bigint(20) not null comment '作者id',
`a_is_open` boolean default true comment '文章是否可見',
`a_is_original` boolean default true comment '文章是否原創(chuàng)',
`next_a_id` bigint(20) default -1 comment '下篇文章id',
`pre_a_id` bigint(20) default -1 comment '前一篇文章的id',
`a_reading_number` int default 0 comment '文章閱讀數(shù)',
`a_publish_date` datetime not null comment '文章發(fā)布時間',
`a_update_date` datetime default null comment '文章的更新時間'
) comment '文章表';
CREATE TABLE `tag`
(
`tag_id` bigint(20) primary key auto_increment,
`tag_name` varchar(255) not null,
`articles` tinytext default null comment 'tag對應的文章id'
) comment '標簽表';
CREATE table `category`
(
`c_id` bigint(20) primary key auto_increment,
`c_name` varchar(255) not null,
`articles` varchar(255) comment '分類下的文章'
) comment '分類表';
CREATE TABLE `comment`
(
`co_id` bigint(20) primary key auto_increment,
`co_article_id` bigint(20) default -1 comment '文章id',
`is_comment` boolean default true comment '是否是評論',
`author_id` bigint(20) not null comment '留言者id',
`co_content` text not null comment '評論/留言內(nèi)容',
`co_date` datetime not null comment '評論/留言的日期',
`co_pid` bigint not null default -1 comment '評論/留言的父id',
`co_response_id` tinytext
) comment '評論/留言表';
CREATE TABLE `links`
(
`site_id` bigint(20) primary key auto_increment,
`site_name` varchar(255) not null comment '友站名稱',
`is_open` boolean default true comment '是否公開',
`site_url` varchar(255) not null comment '首頁地址'
) comment '友站表';
CREATE TABLE `visitor`
(
`v_id` bigint(20) primary key auto_increment,
`v_date` datetime not null comment '訪問時間',
`v_ip` varchar(255) not null comment '訪客ip',
`v_user_agent` text comment '訪客ua'
) comment '訪客表';
CREATE TABLE IF NOT EXISTS `web_update`
(
`update_id` bigint(20) primary key auto_increment,
`update_info` varchar(255) not null comment '更新內(nèi)容',
`update_time` datetime not null comment '更新時間'
) comment '更新內(nèi)容表';
create table `user`
(
`u_id` int not null primary key auto_increment,
`u_email` varchar(50) not null,
`u_uid` varchar(40) default null comment '用戶唯一標識碼',
`u_pwd` varchar(40) not null comment '密碼',
`email_status` boolean default false comment '郵箱驗證狀態(tài)',
`u_avatar` varchar(255) comment '用戶頭像',
`u_desc` tinytext comment '用戶的描述',
`recently_landed_time` datetime comment '最近的登錄時間',
`email_verify_id` varchar(40) comment '用于找回密碼或驗證郵箱的id',
`display_name` varchar(30) comment '展示的昵稱',
`role` varchar(40) not null default 'user' comment '權限組',
unique key `uni_user_id` (`u_id`),
unique key `uni_user_uid` (`u_uid`),
unique key `uni_user_email` (`u_email`)
) comment '用戶表';
前端界面
首頁:
文章頁面
后臺管理頁面(管理員)
(用戶)
總結
目前網(wǎng)站還存在的問題:
未來增加的功能:
因為項目不定時更新,所以一些問題請移步于github
https://github.com/xiaohai2271/blog
開發(fā)這個博客我走的路算是比較曲折齐遵,多次重構寂玲、前端頁面多次更換框架、前后端的整合多次調(diào)整洛搀。如今才算是勉強穩(wěn)定下來敢茁。
我深知這個博客還有很多不足,代碼也還有很多不規(guī)范的地方留美,我也會不斷的修改,不斷的完善
詳情:https://www.celess.cn
項目已上傳github
前端部分:https://github.com/xiaohai2271/blog-frontEnd
后端部分:https://github.com/xiaohai2271/blog-backEnd
如果對你有幫助伸刃,請多多支持我谎砾,幫我點一個star ?