Skip to content

Commit

Permalink
"default change"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiale-Fang committed May 30, 2021
1 parent 25e3d8c commit e4bc566
Show file tree
Hide file tree
Showing 14 changed files with 221 additions and 52 deletions.
72 changes: 52 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
(入站须知)

**使用该源码希望能够注明原博客以及源码出处,并禁止商用,谢谢!**
@[TOC](入站须知)
# 一.个人博客简介
项目地址:http://119.23.62.26 (源码地址在本文末尾)
项目地址:http://www.tcefrep.site/ (源码地址在本文末尾),感谢阿里云爸爸,送了一个两个月的2核4g的服务器,现在搜索模块也用上了elasticsearch
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210327193121530.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)

## 1.1 博客主要页面:
###  1.1.1 首页
![在这里插入图片描述](https://img-blog.csdnimg.cn/2021032119414418.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)
Expand Down Expand Up @@ -34,6 +35,12 @@
###  1.1.10 爬虫页面
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210321171848526.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)
 从csdn爬取了三千篇文章放到数据库做文本分类的训练集,仅做学习使用。
###  1.1.11 AI模块页面
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210520160303802.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210520160354387.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210520160411972.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210520162319335.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)


## 1.2 博客后台管理页面:
>  后台管理主要有三大模块构成:用户管理,博客管理,数据统计构成。
Expand Down Expand Up @@ -79,26 +86,33 @@
 歌单和MV中都有评论
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210321195815619.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210321195845890.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)
## 1.4 网站聊天室模块:
### 1.4.1 初始界面

## 1.4 功能介绍:
![在这里插入图片描述](https://img-blog.csdnimg.cn/2021052015541869.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)
### 1.4.2 群聊界面
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210520155458917.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)
### 1.4.3 私聊界面
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210520155515445.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)

## 1.5 功能介绍:
 本博客简单实现了博客展示、后台管理、发布博客还有评论等功能,其中后台管理、发布博客和评论功能要在用户登录后才可使用,而后台管理的某些功能普通用户只有查看的权限,并没有分配增删改的权限。
> 需要知道的,项目有两个版本,master分支是已经上线了的项目源码地址,dev分支则是我后来加的ElasticSearch,至于为什么不放到服务器上,是因为ElasticSearch太占内存了,阿里云1核两G的学生机根本跑不起来,所以只能在本地用VMware创建虚拟机跑一下玩玩。
## 1.5 博客介绍
## 1.6 博客介绍
 由于博客是由博主一人完成的,所以暂且只做了一些简单的功能,部分地方还是有不完善的地方甚至有bug,欢迎各位在本篇博文下评论处指出。

## 1.6 Tips
###  1.6.1
## 1.7 Tips
###  1.7.1
 编写博客的markdown编辑器在文章过长时,编写栏和预览栏可能会有错位,此时可手动拉动预览栏滚动条)
###  1.6.2
###  1.7.2
 暂未设置图片上传功能,涉及图片的上传和使用建议使用网络地址。推荐的图片地址(https://picsum.photos/images#1),使用的时候,将右侧链接的(https://unsplash.it/100/100?image=1002) ***1002*** 改成自己的图片id即可,100/100是图片的尺寸,即长宽。
###  1.6.3
###  1.7.3
 前端的请求没有用baseURL封装到一个js里。
###  1.6.4
###  1.7.4
 由于笔者偷懒,没有使用vuex存储某些共享数据,用的都是sessionstorage。

# 二.前端开发:
## 2.1 简介:
 ***https://gitee.com/fang-jiale/blog-vue***(前端源码地址)
 ***https://github.com/asiL-tcefreP/blog-vue***(前端源码地址)
 采用了vue.js,前端框架采用了semantic-ui和element-ui,此外还有一些关于页面动态和渲染的js和css类似(animate.css,pricsm等)。此外,需要说明的是,本人后端狗一枚,页面样式是基于网上部分模板样式的修改,其余开发是独立完成的。
## 2.2 项目介绍
 项目结构采用的是vue-cli3,值得一提的是其中用到的插件还是不错的。
Expand Down Expand Up @@ -128,23 +142,24 @@
[音乐播放器 vue-aplayer](https://aplayer.netlify.app/docs/guide/)
# 三.后端开发:
## 3.1 简介:
 ***https://gitee.com/fang-jiale/blog***(后端源码地址)
 ***https://github.com/asiL-tcefreP/blog***(后端源码地址)
>- 大致框架采用了SpringBoot+MybatisPlus+SpringCloud(Eureka)+ElasticSearch完成的,用redis做缓存中间件,采用微服务的架构。
>- 安全方面采用了SpringSecurity和BCEncrypt
>- 用了jwt来请求访问接口
>- 利用RSA算法对前端发送的重要参数进行加密,经过网关解密后把参数发送到后端服务器。
>- 由于服务器内存和配置的原因,服务器只上线了四个模块
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210321201208846.png)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210520155833969.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)

![在这里插入图片描述](https://img-blog.csdnimg.cn/20210321200814120.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)
>项目是由七个模块组成的,
>项目是由八个模块组成的,
>- blog-common: 博客服务端的实体类
>- blog-encrypt: 博客的服务代理类(从前端接收请求,网关RSA解密后转发给服务端接口)
> - blog-eureka: 微服务注册中心server
> - blog-server: 主体服务端
> - blog-extension: 拓展服务端(留言和友链功能)
> - **blog-search-api:** **ElasticSearch的服务端,在dev分支才有该模块,master分支中没有。**
> - blog-extension: 拓展服务端(留言和友链功能),上线的版本集成了blog-search-api模块,因为阿里云服务器内存太小了
> - **blog-search-api:** **ElasticSearch的服务端,分出一个模块是为了更清晰的展现微服务架构,但是服务器内存太小,所以集成在上述模块中,自己开发可以直接使用本模块**
> - blog-article-crawler:爬虫和人工智能模块,用的webmagic框架爬取数据,deeplearning4j做文本分类
> - blog-ai:里面的服务类调用了py脚本来实现古诗词生成
## 3.3 开发中遇到的一些问题:
### 3.3.1 关于jwt与zuul
Expand Down Expand Up @@ -311,9 +326,26 @@ public class RSARequestFilter extends ZuulFilter {
 

### 3.6 关于AI和爬虫模块
  用了三千篇从csdn上爬取下来的文章做训练集。总共迭代了二十次,词向量维度是200,用DeepLearning4j的cnn文本分类算法,但是最终算法效果还是差强人意。对于MachineLearning而言,这些数据量属实太少,但是仅仅迭代了这么少的数据量和次数,都要花费笔者四五十分钟的时间。
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210321202044482.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210321202132263.png)
  用了三千篇从csdn上爬取下来的文章做训练集。总共迭代了二十次,词向量维度是200,
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210520162239476.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210520162244323.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)

可以看到的是在第一个Epoch,准确率只有65%,但是在第二个Epoch的时候已经有了明显提升。



第十次Epoch,loss值在0.6左右


第二十次Epoch,loss值在0.4左右


第三十次Epoch,loss值在0.2几左右,但是此时准确率已经达到了96.7%。

![在这里插入图片描述](https://img-blog.csdnimg.cn/202105201622325.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)

第四十次Epoch,loss值约在0.2,准确率达到97.6%。
训练完成后,用ModelSerializer.writeModel方法将模型持久化即可。
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210321202304392.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210321202310544.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RsaWhjdGNlZnJlcA==,size_16,color_FFFFFF,t_70)
>  根据爬取下来的三千篇文章的内容和标题做的分词,以及词向量分析,算法就不在此细说了,用的都是别人的,源码中都有。
Expand Down
Binary file modified public/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<!-- <link rel="icon" type="image/x-icon"/>-->
<!-- 引入semantic-ui的css-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.11.1/tocbot.css">
Expand Down
6 changes: 6 additions & 0 deletions src/assets/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ p {
padding: 50px 40px;
margin: 382px auto 70px auto;
}
.blog-container2 {
animation: main 1s;
max-width: 970px;
padding: 50px 40px;
margin: auto auto auto auto;
}
.login-container {
padding: 1rem;
border-radius: 4px;
Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<el-footer app padless absolute>
<div class="footer-wrap">
<div>&copy; 2021 - {{ new Date().getFullYear() }} By Tcefrep</div>
<a href="https://gitee.com/" target="_blank">
暂无备份
<a href="http://beian.miit.gov.cn/" target="_blank">
粤ICP备2021070728号
</a>
</div>
</el-footer>
Expand Down
2 changes: 1 addition & 1 deletion src/components/model/SearchModel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default {
pageSize: 100,
queryString: value
}
this.$http.post('/search/searchPage1', param).then((res) => {
this.$extension.post('/search/searchPage1', param).then((res) => {
// this.$http.post('/extension/search/searchPage1', param).then((res) => {
// 关闭新增窗口
if (res.data.flag) {
Expand Down
8 changes: 6 additions & 2 deletions src/main-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ const instance = axios.create({ // 网易云接口api地址
})
Vue.prototype.$musicApi = instance
const instance2 = axios.create({ // ai接口api地址,填自己的
baseURL: 'http://119.23.62.26:9007/'
baseURL: 'http://1.116.229.15:9007/'
})
Vue.prototype.$AI = instance2
const instance4 = axios.create({ // ai接口api地址,填自己的
baseURL: 'http://127.0.0.1:9005/'
})
Vue.prototype.$AI2 = instance4
/**
* 配置全局接口加密方法
* @param obj
Expand Down Expand Up @@ -68,7 +72,7 @@ axios.interceptors.response.use(config => {
})
Vue.config.productionTip = false
const instance3 = axios.create({ // ai接口api地址,填自己的
baseURL: 'http://127.0.0.1:9003/'
baseURL: 'http://1.116.229.15:9003/'
})
Vue.prototype.$extension = instance3
new Vue({
Expand Down
10 changes: 9 additions & 1 deletion src/main-prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ const instance = axios.create({ // 网易云接口api地址
})
Vue.prototype.$musicApi = instance
const instance2 = axios.create({ // ai接口api地址,填自己的
baseURL: 'http://119.23.62.26:9007/'
baseURL: 'http://1.116.229.15:9007/'
})
Vue.prototype.$AI = instance2
const instance4 = axios.create({ // ai接口api地址,填自己的
baseURL: 'http://1.116.229.15:9005/'
})
Vue.prototype.$AI2 = instance4
Vue.prototype.$encruption = function (obj) {
const encrypt = new JsEncrypt()
encrypt.setPublicKey('MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzSJK+Pc1IdFWz83FWvKH' +
Expand Down Expand Up @@ -64,6 +68,10 @@ axios.interceptors.response.use(config => {
return config
})
Vue.config.productionTip = false
const instance3 = axios.create({ // ai接口api地址,填自己的
baseURL: 'http://1.116.229.15:9003/'
})
Vue.prototype.$extension = instance3
new Vue({
el: '#app',
router,
Expand Down
3 changes: 2 additions & 1 deletion src/views/Blog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,8 @@ export default {
const blogId = sessionStorage.getItem('blogId')
const { data: res } = await this.$http.get(`/server/blog/${blogId}`)
if (!res.flag) {
return this.$message.error('获取博客信息失败!')
// return this.$message.error('获取博客信息失败!')
return this.$message.error(res.message)
}
this.dataList = res.data
},
Expand Down
3 changes: 1 addition & 2 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ export default {
this.getTagList()
this.getLatestList()
this.reload()
this.$http.get('server/admapi/test')
},
methods: {
reload () {
Expand All @@ -245,7 +244,7 @@ export default {
Notification({
title: '通知',
message: h('i', { style: 'color: teal' }, '此次更新了一个新模块:聊天室模块,后花园也有新功能,测试还不完善可能还有bug。' +
'用户数据都被删除了,需要各位重新注册一个账号,不便之处敬请谅解'),
'有关ElasticSearch服务的2核4G服务器过期了(由于贫穷),搜索功能暂时无法使用,敬请谅解'),
duration: 0
})
}
Expand Down
21 changes: 0 additions & 21 deletions src/views/Link.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
</div>
</div>
</el-col>
<!-- </div>-->
<!-- <div style="width: 100px;height: 200px" :key="index">-->
<el-col style="width: 400px;margin-top: 30px!important;top: 15px !important;float: right !important;" v-if="index%2===1" v-bind:key="item.linkId">
<div class="ui card my-shadow">
<div class="image">
Expand All @@ -74,25 +72,6 @@
</div>
</div>
</el-col>
<!-- </div>-->
<!-- <el-col style="width: 400px;top: 15px !important;" v-for="item in dataList" :key="item.LinkId">-->
<!-- <div class="ui card my-shadow">-->
<!-- <div class="image">-->
<!-- <img v-bind:src="item.avatarLink">-->
<!-- </div>-->
<!-- <div class="content">-->
<!-- <a class="header">Kristy</a>-->
<!-- <div class="meta">-->
<!-- <span class="date">2013年加入</span>-->
<!-- </div>-->
<!-- <div class="description">Kristy is an art director living in New York. </div>-->
<!-- </div>-->
<!-- <div class="extra content">-->
<!-- <a><i class="desktop icon"></i> 22 个好友 </a>-->
<!-- </div>-->
<!-- </div>-->
<!-- </el-col>-->
<!-- </el-row>-->
</template>
<br>
<br>
Expand Down
Loading

0 comments on commit e4bc566

Please sign in to comment.