Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
代码敲不队
YoubiliProject
提交
593b604a
Y
YoubiliProject
项目概览
代码敲不队
/
YoubiliProject
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YoubiliProject
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
593b604a
编写于
7月 14, 2023
作者:
喷火的神灵
🎱
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
将分类数据写入缓存之中
上级
9e17c6ca
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
305 addition
and
134 deletion
+305
-134
YouBili_front/src/utils/option.js
YouBili_front/src/utils/option.js
+9
-0
YouBili_front/src/utils/request.js
YouBili_front/src/utils/request.js
+1
-1
YouBili_front/src/views/contribute/contribute.vue
YouBili_front/src/views/contribute/contribute.vue
+25
-17
YouBili_front/src/views/personal/follow.vue
YouBili_front/src/views/personal/follow.vue
+1
-24
YouBili_front/src/views/personal/otherSpace.vue
YouBili_front/src/views/personal/otherSpace.vue
+1
-1
YouBili_front/src/views/personal/personalCenter.vue
YouBili_front/src/views/personal/personalCenter.vue
+27
-15
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/common/cacheUtils/classification/dao/cache/impl/ClssificationCacheImpl.java
...classification/dao/cache/impl/ClssificationCacheImpl.java
+2
-1
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/count/dao/cache/UserCountCacheRepository.java
...odules/user/count/dao/cache/UserCountCacheRepository.java
+31
-0
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/count/dao/cache/impl/UserCountCacheRepositoryImpl.java
...er/count/dao/cache/impl/UserCountCacheRepositoryImpl.java
+133
-0
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/count/service/CountSerivce.java
...ojectbackend/modules/user/count/service/CountSerivce.java
+4
-0
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/count/service/impl/countServiceImpl.java
...end/modules/user/count/service/impl/countServiceImpl.java
+4
-0
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/follow/dao/persist/mapper/FollowMapper.java
.../modules/user/follow/dao/persist/mapper/FollowMapper.java
+2
-1
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/follow/dao/persist/repository/IFollowRepository.java
...user/follow/dao/persist/repository/IFollowRepository.java
+2
-1
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/follow/dao/persist/repository/impl/FollowRepositoryImpl.java
...low/dao/persist/repository/impl/FollowRepositoryImpl.java
+3
-3
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/follow/pojo/entity/followedID.java
...ctbackend/modules/user/follow/pojo/entity/followedID.java
+10
-0
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/follow/service/impl/FollowServiceImpl.java
...d/modules/user/follow/service/impl/FollowServiceImpl.java
+12
-3
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/video/uplaod/controller/VideoUploadController.java
...odules/video/uplaod/controller/VideoUploadController.java
+0
-63
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/video/uplaod/video.md
.../tedu/youbiliprojectbackend/modules/video/uplaod/video.md
+0
-1
youbili-project-backend/src/main/resources/application.yaml
youbili-project-backend/src/main/resources/application.yaml
+1
-1
youbili-project-backend/src/main/resources/mapper/user/FollowMapper.xml
...t-backend/src/main/resources/mapper/user/FollowMapper.xml
+2
-2
youbili-project-backend/src/main/resources/mapper/video/VideoCategoryMapper.xml
...d/src/main/resources/mapper/video/VideoCategoryMapper.xml
+12
-0
youbili-project-backend/src/main/resources/mapper/video/VideoTagMapper.xml
...ackend/src/main/resources/mapper/video/VideoTagMapper.xml
+11
-0
youbili-project-backend/src/main/resources/mapper/video/VideoUploadMapper.xml
...end/src/main/resources/mapper/video/VideoUploadMapper.xml
+12
-0
未找到文件。
YouBili_front/src/utils/option.js
浏览文件 @
593b604a
...
...
@@ -327,3 +327,12 @@ export function uploadVideo(params) {
}
})
}
// 上传视频信息
export
function
uploadContent
(
params
)
{
return
request
({
method
:
"
post
"
,
url
:
"
/video/uploadContent
"
,
data
:
params
})
}
YouBili_front/src/utils/request.js
浏览文件 @
593b604a
...
...
@@ -3,7 +3,7 @@ import axios from 'axios'
const
instance
=
axios
.
create
({
// API接口的base_url
// baseURL: 'http://youbili2303.nat300.top',
baseURL
:
'
http://localhost:
8089
'
,
baseURL
:
'
http://localhost:
10001
'
,
// 超时时间
timeout
:
20000
,
// headers配置
...
...
YouBili_front/src/views/contribute/contribute.vue
浏览文件 @
593b604a
...
...
@@ -96,7 +96,7 @@
:file-list=
"fileList"
>
<i
class=
"el-icon-upload"
></i>
<div
class=
"el-upload__text"
>
将文件拖到此处,或
<em>
点击上传
</em></div>
<div
class=
"el-upload__tip"
slot=
"tip"
>
只能上传mpe4文件,且不超过500mb
</div>
<div
class=
"el-upload__tip"
slot=
"tip"
>
只能上传mpe4文件,
最少上传1920*1080
且不超过500mb
</div>
<p>
{{
msg
}}
</p>
</el-upload>
</div>
...
...
@@ -119,7 +119,7 @@
<!-- 视频标签开始 -->
<div>
<h3>
标签
</h3>
<el-select
v-model=
"video.tag"
placeholder=
"请选择标签分类"
>
<el-select
multiple
collapse-tags
v-model=
"video.tag"
placeholder=
"请选择标签分类"
>
<el-option
v-for=
"item in tagList"
:key=
"item.value"
...
...
@@ -142,6 +142,7 @@
<
script
>
import
{
uploadVideo
,
// 上传视频
uploadContent
,
// 提交视频信息
}
from
"
@/utils/option
"
export
default
{
name
:
"
contribute
"
,
...
...
@@ -155,7 +156,7 @@ export default {
videoImgUrl
:
""
,
// 视频封面
videoSrcUrl
:
""
,
type
:
""
,
// 分类
tag
:
""
// 标签
tag
:
[]
// 标签
},
msg
:
""
,
/*文本框*/
...
...
@@ -164,35 +165,38 @@ export default {
/*文本框*/
/*视频分类*/
options
:
[{
value
:
'
选项1
'
,
label
:
'
综艺
'
},
{
value
:
'
选项2
'
,
value
:
'
2
'
,
label
:
'
电影
'
},
{
value
:
'
选项
3
'
,
value
:
'
3
'
,
label
:
'
电视剧
'
},
{
value
:
'
选项4
'
,
value
:
'
4
'
,
label
:
'
综艺
'
},
{
value
:
'
5
'
,
label
:
'
动漫
'
},
{
value
:
'
选项5
'
,
label
:
'
鬼畜
'
value
:
'
6
'
,
label
:
'
自制
'
},
{
value
:
'
7
'
,
label
:
'
搬运
'
}],
tagList
:
[{
value
:
'
选项
1
'
,
value
:
'
1
'
,
label
:
'
鬼畜
'
},
{
value
:
'
选项
2
'
,
value
:
'
2
'
,
label
:
'
搞笑
'
},
{
value
:
'
选项
3
'
,
value
:
'
3
'
,
label
:
'
热血
'
},
{
value
:
'
选项
4
'
,
value
:
'
4
'
,
label
:
'
恐怖
'
},
{
value
:
'
选项
5
'
,
value
:
'
5
'
,
label
:
'
睡眠
'
}],
value
:
''
,
...
...
@@ -210,7 +214,11 @@ export default {
// 上传给后台管理视频信息
uploadInformation
()
{
console
.
log
(
this
.
video
);
uploadContent
(
this
.
video
).
then
(
res
=>
{
if
(
res
.
success
)
{
alert
(
"
成了
"
)
}
})
},
// 上传视频
uploadVideoFile
(
param
)
{
...
...
YouBili_front/src/views/personal/follow.vue
浏览文件 @
593b604a
...
...
@@ -162,30 +162,7 @@ export default {
})
console
.
log
(
arr
)
}
// toggleFollow(event) {
// console.log(111)
// // 获取点击的按钮对应的用户 id
// let id = event.target.value;
// // 在 number 数组中找到对应的用户对象
// let user = this.number.find(v => v.id == id);
// // 切换用户的关注状态
// this.user.type = !this.user.type;
// if (this.user.type) {
// // 弹出关注成功的框框
// Notification(this.$notify)({
// title: '关注成功',
// offset: 100,
// type: "success"
// });
// } else {
// // 弹出取消关注成功的框框
// Notification(this.$notify)({
// title: '取消关注',
// offset: 100,
// type: "error"
// });
// }
// },
},
created
()
{
...
...
YouBili_front/src/views/personal/otherSpace.vue
浏览文件 @
593b604a
...
...
@@ -47,7 +47,7 @@
<div>
<el-card
style=
"margin-bottom: 10px;"
v-for=
"p in user.videoList.slice(0,
3)
"
><div
style=
"float: left"
><img
:src=
"p.videoImgUrl"
<el-card
style=
"margin-bottom: 10px;"
v-for=
"p in user.videoList.slice(0,
6)"
v-if=
"p !==null
"
><div
style=
"float: left"
><img
:src=
"p.videoImgUrl"
style=
"width: 300px;height: 250px;margin-left: 80px"
></div>
<div
style=
"width: 700px;height: 250px;;float: right"
>
<div
style=
"height: 180px;"
>
...
...
YouBili_front/src/views/personal/personalCenter.vue
浏览文件 @
593b604a
...
...
@@ -4,7 +4,7 @@
<div>
<div
class=
"idxs"
>
<h1
style=
"font-size: 45px;text-align: center;margin-top: 30px;margin-bottom: 30px"
>
{{
this
.
user
.
nickname
}}
的个人中心
</h1>
{{
user
.
nickname
}}
的个人中心
</h1>
<div
style=
"width: 1300px;height: 120px;margin-left: 50px;margin-bottom: 50px"
>
...
...
@@ -13,9 +13,9 @@
<el-avatar
style=
"margin-bottom: 15px;float:left;width: 100px;height: 100px;"
:src=
"user.imgUrl"
alt=
"头像"
:round=
"true"
></el-avatar>
<ul
style=
"float: left;margin-top: 30px;margin-left: 30px;list-style-type: none"
>
<li>
昵称:
{{
this
.
user
.
nickname
}}
</li>
<li>
生日:
{{
this
.
user
.
birthday
}}
</li>
<li>
会员等级:
{{
this
.
user
.
accountLevel
}}
</li>
<li>
昵称:
{{
user
.
nickname
}}
</li>
<li>
生日:
{{
user
.
birthday
}}
</li>
<li>
会员等级:
{{
user
.
accountLevel
}}
</li>
</ul>
<div
style=
"width: 300px;float: right;padding-top: 20px"
>
...
...
@@ -25,15 +25,15 @@
<el-descriptions
style=
"margin-left: 10px;"
class=
"margin-top"
:column=
"4"
direction=
"vertical"
:colon=
"false"
>
<el-descriptions-item
class=
"aa"
label=
"关注数"
>
{{
this
.
user
.
follows
user
.
follows
}}
</el-descriptions-item>
<el-descriptions-item
class=
"aa"
label=
"粉丝数"
>
{{
this
.
user
.
fans
user
.
fans
}}
</el-descriptions-item>
<el-descriptions-item
class=
"aa"
label=
"获赞数"
>
{{
this
.
user
.
totalLikes
user
.
totalLikes
}}
</el-descriptions-item>
...
...
@@ -51,7 +51,7 @@
<h2>
{{
c
}}
</h2>
<el-divider></el-divider>
<div>
<el-card
style=
"margin-bottom: 10px;"
v-for=
"p in user.videoList.slice(id*3,(id+1)*3)"
>
<el-card
style=
"margin-bottom: 10px;"
v-for=
"p in user.videoList.slice(id*3,(id+1)*3)"
v-if=
"p !== null"
>
<div
style=
"float: left"
><img
:src=
"p.videoImgUrl"
style=
"width: 300px;height: 250px;margin-left: 80px"
>
</div>
...
...
@@ -91,6 +91,7 @@ import Sidebar from "@/components/sidebar.vue";
import
Handder
from
"
@/components/Handder.vue
"
;
import
{
getPersonalCenterInfo
}
from
"
@/utils/option
"
;
export
default
{
name
:
"
personalCenter
"
,
components
:
{
Handder
,
Sidebar
},
...
...
@@ -126,13 +127,24 @@ export default {
},
methods
:
{},
created
()
{
getPersonalCenterInfo
(
1
).
then
(
response
=>
{
if
(
response
.
status
==
20000
)
{
this
.
user
=
response
.
data
;
}
else
{
this
.
$message
.
error
(
response
.
message
)
}
})
// this.$nextTick(() => {
getPersonalCenterInfo
(
1
).
then
(
response
=>
{
if
(
response
.
success
)
{
// console.log(response.data)
this
.
user
=
response
.
data
;
console
.
log
(
this
.
user
)
}
else
{
this
.
$message
.
error
(
response
.
message
)
}
})
// })
},
mounted
()
{
setTimeout
(()
=>
{
console
.
log
(
this
.
user
)
},
200
)
}
}
</
script
>
...
...
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/common/cacheUtils/classification/dao/cache/impl/ClssificationCacheImpl.java
浏览文件 @
593b604a
package
cn.tedu.youbiliprojectbackend.common.cacheUtils.classification.dao.cache.impl
;
import
cn.tedu.youbiliprojectbackend.common.cacheUtils.classification.dao.cache.ClassificationCache
;
import
cn.tedu.youbiliprojectbackend.modules.tag.classification.dao.repository.ICategoryRepository
;
import
cn.tedu.youbiliprojectbackend.modules.tag.classification.pojo.vo.CategoryTitleVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
...
...
@@ -13,6 +12,7 @@ import java.util.List;
/**
* 实现类
*
* @author 赵錾
*/
@Repository
...
...
@@ -20,6 +20,7 @@ public class ClssificationCacheImpl implements ClassificationCache {
@Autowired
RedisTemplate
<
String
,
Serializable
>
template
;
/**
* 将分类信息放入缓存之中;
*/
...
...
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/count/dao/cache/UserCountCacheRepository.java
0 → 100644
浏览文件 @
593b604a
package
cn.tedu.youbiliprojectbackend.modules.user.count.dao.cache
;
import
cn.tedu.youbiliprojectbackend.common.consts.UserCacheConsts
;
public
interface
UserCountCacheRepository
extends
UserCacheConsts
{
/**
* 向redis之中的计数字段添加粉丝数+1;
* @param userID
*/
void
addFans
(
Long
userID
);
/**
* 向redis之中的计数字段粉丝数-1;
* @param userID
*/
void
removeFans
(
Long
userID
);
/**
* 向redis之中的计数字段关注数+1;
* @param userID
*/
void
addFollow
(
Long
userID
);
/**
* 向redis之中的计数字段粉丝数-1;
* @param userID
*/
void
removeFollow
(
Long
userID
);
}
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/count/dao/cache/impl/UserCountCacheRepositoryImpl.java
0 → 100644
浏览文件 @
593b604a
package
cn.tedu.youbiliprojectbackend.modules.user.count.dao.cache.impl
;
import
cn.tedu.youbiliprojectbackend.common.cacheUtils.count.user.pojo.vo.UserCountsCacheVO
;
import
cn.tedu.youbiliprojectbackend.common.ex.ServiceException
;
import
cn.tedu.youbiliprojectbackend.common.web.response.ServiceCode
;
import
cn.tedu.youbiliprojectbackend.modules.user.count.dao.cache.UserCountCacheRepository
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.ValueOperations
;
import
org.springframework.stereotype.Repository
;
import
java.io.Serializable
;
import
static
cn
.
tedu
.
youbiliprojectbackend
.
common
.
consts
.
CountConsts
.
USER_COUNT
;
@Repository
public
class
UserCountCacheRepositoryImpl
implements
UserCountCacheRepository
{
@Autowired
RedisTemplate
<
String
,
Serializable
>
redisTemplate
;
/**
* 向redis之中的计数字段添加粉丝数+1;
*
* @param userID
*/
@Override
public
void
addFans
(
Long
userID
)
{
ValueOperations
<
String
,
Serializable
>
operations
=
redisTemplate
.
opsForValue
();
try
{
//当添加关注时,默认走到这里; 先认为这个字段的值未在redis之中修改过;
UserCountsCacheVO
serializable
=
(
UserCountsCacheVO
)
operations
.
get
(
USER_COUNT
+
userID
+
":"
+
true
);
serializable
.
setFans
(
serializable
.
getFans
()+
1
);
operations
.
set
(
USER_COUNT
+
userID
+
":"
+
true
,
serializable
);
redisTemplate
.
rename
(
USER_COUNT
+
userID
+
":"
+
true
,
USER_COUNT
+
userID
+
":"
+
false
);
}
catch
(
Throwable
e
){
// 在上面的try之中找不到key的值;则走到这个代码块之中
try
{
//认为这个字段已经被修改过了; 则状态值字段为false
UserCountsCacheVO
serializable
=
(
UserCountsCacheVO
)
operations
.
get
(
USER_COUNT
+
userID
+
":"
+
false
);
System
.
out
.
println
(
serializable
);
serializable
.
setFans
(
serializable
.
getFans
()+
1
);
operations
.
set
(
USER_COUNT
+
userID
+
":"
+
false
,
serializable
);
}
catch
(
Throwable
e1
){
throw
new
ServiceException
(
ServiceCode
.
ERROR_CONFLICT
,
"用户ID错误"
);
}
}
}
/**
* 向redis之中的计数字段粉丝数-1;
*
* @param userID
*/
@Override
public
void
removeFans
(
Long
userID
)
{
ValueOperations
<
String
,
Serializable
>
operations
=
redisTemplate
.
opsForValue
();
try
{
//当添加关注时,默认走到这里; 先认为这个字段的值未在redis之中修改过;
UserCountsCacheVO
serializable
=
(
UserCountsCacheVO
)
operations
.
get
(
USER_COUNT
+
userID
+
":"
+
true
);
serializable
.
setFans
(
serializable
.
getFans
()
-
1
);
operations
.
set
(
USER_COUNT
+
userID
+
":"
+
true
,
serializable
);
redisTemplate
.
rename
(
USER_COUNT
+
userID
+
":"
+
true
,
USER_COUNT
+
userID
+
":"
+
false
);
}
catch
(
Throwable
e
){
// 在上面的try之中找不到key的值;则走到这个代码块之中
try
{
//认为这个字段已经被修改过了; 则状态值字段为false
UserCountsCacheVO
serializable
=
(
UserCountsCacheVO
)
operations
.
get
(
USER_COUNT
+
userID
+
":"
+
false
);
System
.
out
.
println
(
serializable
);
serializable
.
setFans
(
serializable
.
getFans
()
-
1
);
operations
.
set
(
USER_COUNT
+
userID
+
":"
+
false
,
serializable
);
}
catch
(
Throwable
e1
){
throw
new
ServiceException
(
ServiceCode
.
ERROR_CONFLICT
,
"用户ID错误"
);
}
}
}
/**
* 向redis之中的计数字段关注数+1;
*
* @param userID
*/
@Override
public
void
addFollow
(
Long
userID
)
{
ValueOperations
<
String
,
Serializable
>
operations
=
redisTemplate
.
opsForValue
();
try
{
//当添加关注时,默认走到这里; 先认为这个字段的值未在redis之中修改过;
UserCountsCacheVO
serializable
=
(
UserCountsCacheVO
)
operations
.
get
(
USER_COUNT
+
userID
+
":"
+
true
);
serializable
.
setFans
(
serializable
.
getFollows
()+
1
);
operations
.
set
(
USER_COUNT
+
userID
+
":"
+
true
,
serializable
);
redisTemplate
.
rename
(
USER_COUNT
+
userID
+
":"
+
true
,
USER_COUNT
+
userID
+
":"
+
false
);
}
catch
(
Throwable
e
){
// 在上面的try之中找不到key的值;则走到这个代码块之中
try
{
//认为这个字段已经被修改过了; 则状态值字段为false
UserCountsCacheVO
serializable
=
(
UserCountsCacheVO
)
operations
.
get
(
USER_COUNT
+
userID
+
":"
+
false
);
System
.
out
.
println
(
serializable
);
serializable
.
setFans
(
serializable
.
getFollows
()+
1
);
operations
.
set
(
USER_COUNT
+
userID
+
":"
+
false
,
serializable
);
}
catch
(
Throwable
e1
){
throw
new
ServiceException
(
ServiceCode
.
ERROR_CONFLICT
,
"用户ID错误"
);
}
}
}
/**
* 向redis之中的计数字段粉丝数-1;
*
* @param userID
*/
@Override
public
void
removeFollow
(
Long
userID
)
{
ValueOperations
<
String
,
Serializable
>
operations
=
redisTemplate
.
opsForValue
();
try
{
//当添加关注时,默认走到这里; 先认为这个字段的值未在redis之中修改过;
UserCountsCacheVO
serializable
=
(
UserCountsCacheVO
)
operations
.
get
(
USER_COUNT
+
userID
+
":"
+
true
);
serializable
.
setFans
(
serializable
.
getFollows
()-
1
);
operations
.
set
(
USER_COUNT
+
userID
+
":"
+
true
,
serializable
);
redisTemplate
.
rename
(
USER_COUNT
+
userID
+
":"
+
true
,
USER_COUNT
+
userID
+
":"
+
false
);
}
catch
(
Throwable
e
){
// 在上面的try之中找不到key的值;则走到这个代码块之中
try
{
//认为这个字段已经被修改过了; 则状态值字段为false
UserCountsCacheVO
serializable
=
(
UserCountsCacheVO
)
operations
.
get
(
USER_COUNT
+
userID
+
":"
+
false
);
System
.
out
.
println
(
serializable
);
serializable
.
setFans
(
serializable
.
getFollows
()
-
1
);
operations
.
set
(
USER_COUNT
+
userID
+
":"
+
false
,
serializable
);
}
catch
(
Throwable
e1
){
throw
new
ServiceException
(
ServiceCode
.
ERROR_CONFLICT
,
"用户ID错误"
);
}
}
}
}
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/count/service/CountSerivce.java
0 → 100644
浏览文件 @
593b604a
package
cn.tedu.youbiliprojectbackend.modules.user.count.service
;
public
interface
CountSerivce
{
}
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/count/service/impl/countServiceImpl.java
0 → 100644
浏览文件 @
593b604a
package
cn.tedu.youbiliprojectbackend.modules.user.count.service.impl
;
public
class
countServiceImpl
{
}
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/follow/dao/persist/mapper/FollowMapper.java
浏览文件 @
593b604a
package
cn.tedu.youbiliprojectbackend.modules.user.follow.dao.persist.mapper
;
import
cn.tedu.youbiliprojectbackend.modules.user.follow.pojo.entity.Follow
;
import
cn.tedu.youbiliprojectbackend.modules.user.follow.pojo.entity.followedID
;
import
cn.tedu.youbiliprojectbackend.modules.user.follow.pojo.vo.FollowListVO
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -38,7 +39,7 @@ public interface FollowMapper extends BaseMapper<Follow> {
* @param followID 关注表的ID
* @return
*/
int
selectByUserIDAndFollowID
(
Long
userID
,
Long
followID
);
followedID
selectByUserIDAndFollowID
(
Long
userID
,
Long
followID
);
Long
selectByFollowId
(
Long
followID
);
...
...
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/follow/dao/persist/repository/IFollowRepository.java
浏览文件 @
593b604a
package
cn.tedu.youbiliprojectbackend.modules.user.follow.dao.persist.repository
;
import
cn.tedu.youbiliprojectbackend.modules.user.follow.pojo.entity.Follow
;
import
cn.tedu.youbiliprojectbackend.modules.user.follow.pojo.entity.followedID
;
import
cn.tedu.youbiliprojectbackend.modules.user.follow.pojo.vo.FollowListVO
;
import
java.util.List
;
...
...
@@ -42,7 +43,7 @@ public interface IFollowRepository {
* @param followID 关注表ID
* @return
*/
int
selectByUserIDAndFollowID
(
Long
userID
,
Long
followID
);
followedID
selectByUserIDAndFollowID
(
Long
userID
,
Long
followID
);
Long
selectByFollowIdRes
(
Long
followID
);
}
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/follow/dao/persist/repository/impl/FollowRepositoryImpl.java
浏览文件 @
593b604a
...
...
@@ -2,7 +2,7 @@ package cn.tedu.youbiliprojectbackend.modules.user.follow.dao.persist.repository
import
cn.tedu.youbiliprojectbackend.modules.user.follow.dao.persist.mapper.FollowMapper
;
import
cn.tedu.youbiliprojectbackend.modules.user.follow.dao.persist.repository.IFollowRepository
;
import
cn.tedu.youbiliprojectbackend.modules.user.follow.pojo.entity.
Follow
;
import
cn.tedu.youbiliprojectbackend.modules.user.follow.pojo.entity.
followedID
;
import
cn.tedu.youbiliprojectbackend.modules.user.follow.pojo.vo.FollowListVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -27,7 +27,7 @@ public class FollowRepositoryImpl implements IFollowRepository {
/**
* 添加关注
* @param follow 关注实体
* @param follow
ID
关注实体
* @return
*/
@Override
...
...
@@ -58,7 +58,7 @@ public class FollowRepositoryImpl implements IFollowRepository {
}
@Override
public
int
selectByUserIDAndFollowID
(
Long
userID
,
Long
followID
)
{
public
followedID
selectByUserIDAndFollowID
(
Long
userID
,
Long
followID
)
{
return
followMapper
.
selectByUserIDAndFollowID
(
userID
,
followID
);
}
...
...
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/follow/pojo/entity/followedID.java
0 → 100644
浏览文件 @
593b604a
package
cn.tedu.youbiliprojectbackend.modules.user.follow.pojo.entity
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
followedID
implements
Serializable
{
private
Long
followedID
;
}
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/follow/service/impl/FollowServiceImpl.java
浏览文件 @
593b604a
...
...
@@ -2,8 +2,10 @@ package cn.tedu.youbiliprojectbackend.modules.user.follow.service.impl;
import
cn.tedu.youbiliprojectbackend.common.ex.ServiceException
;
import
cn.tedu.youbiliprojectbackend.common.web.response.ServiceCode
;
import
cn.tedu.youbiliprojectbackend.modules.user.count.dao.cache.UserCountCacheRepository
;
import
cn.tedu.youbiliprojectbackend.modules.user.follow.dao.persist.repository.IFollowRepository
;
import
cn.tedu.youbiliprojectbackend.modules.user.follow.pojo.entity.Follow
;
import
cn.tedu.youbiliprojectbackend.modules.user.follow.pojo.entity.followedID
;
import
cn.tedu.youbiliprojectbackend.modules.user.follow.pojo.vo.FollowListVO
;
import
cn.tedu.youbiliprojectbackend.modules.user.follow.service.IFollowService
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -19,6 +21,9 @@ public class FollowServiceImpl implements IFollowService {
@Autowired
IFollowRepository
followRepository
;
@Autowired
UserCountCacheRepository
userCountCacheRepository
;
/**
* 查看关注列表
* @param userID 关注人的ID
...
...
@@ -52,7 +57,8 @@ public class FollowServiceImpl implements IFollowService {
System
.
out
.
println
(
"111"
+
followedID
+
followedID
);
// 下面这个代码有问题
followRepository
.
addFollow
(
followerID
,
followedID
);
userCountCacheRepository
.
addFollow
(
followerID
);
userCountCacheRepository
.
addFans
(
followedID
);
//todo 根据followerID 对用户表关注者的被关注者数量+1
//todo 根据followedID 对用户表被被关注者的关注者数量+1
}
...
...
@@ -66,11 +72,14 @@ public class FollowServiceImpl implements IFollowService {
*/
@Override
public
void
delete
(
Long
userID
,
Long
followID
)
{
int
row
=
followRepository
.
selectByUserIDAndFollowID
(
userID
,
followID
);
if
(
row
<
1
){
followedID
followedIDs
=
followRepository
.
selectByUserIDAndFollowID
(
userID
,
followID
);
log
.
debug
(
String
.
valueOf
(
followedIDs
));
if
(
followedIDs
==
null
){
throw
new
ServiceException
(
ServiceCode
.
ERROR_CONFLICT
,
"您并未关注当前用户,不可进行取消关注操作!"
);
}
followRepository
.
delete
(
userID
,
followID
);
userCountCacheRepository
.
removeFollow
(
userID
);
userCountCacheRepository
.
removeFans
(
followedIDs
.
getFollowedID
());
//todo 根据followerID 对用户表关注者的被关注者数量-1
//todo 根据followedID 对用户表被被关注者的关注者数量-1
}
...
...
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/video/uplaod/controller/VideoUploadController.java
已删除
100644 → 0
浏览文件 @
9e17c6ca
package
cn.tedu.youbiliprojectbackend.modules.video.uplaod.controller
;
import
cn.tedu.youbiliprojectbackend.common.security.CurrentPrincipal
;
import
cn.tedu.youbiliprojectbackend.common.web.response.RestBean
;
import
cn.tedu.youbiliprojectbackend.common.web.response.ServiceCode
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.system.ApplicationHome
;
import
org.springframework.security.core.annotation.AuthenticationPrincipal
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Map
;
@Slf4j
@RestController
@RequestMapping
(
"/video"
)
public
class
VideoUploadController
{
VideoUploadController
(){
log
.
debug
(
"创建控制器类:VideoUploadController"
);
}
@PostMapping
(
"/upload"
)
public
RestBean
<
Object
>
uploadVideo
(
@AuthenticationPrincipal
CurrentPrincipal
principal
,
MultipartFile
file
)
{
log
.
debug
(
"开始处理上传视频请求: /video/upload"
);
// 获取当事人id
Long
id
=
principal
.
getUserID
();
log
.
debug
(
"file{}"
,
file
);
System
.
out
.
println
(
file
+
"123123"
);
if
(
file
.
isEmpty
()
&&
file
.
getOriginalFilename
().
split
(
"\\."
)[
1
]
!=
"mp4"
)
{
// 返回请求参数异常
return
RestBean
.
failure
(
ServiceCode
.
ERROR_BAD_REQUEST
);
}
//上传图片
ApplicationHome
applicationHome
=
new
ApplicationHome
(
this
.
getClass
());
String
pre
=
applicationHome
.
getDir
().
getParentFile
().
getParentFile
().
getAbsolutePath
()
+
"\\src\\main\\resources\\videos\\"
;
String
path
=
pre
+
file
.
getOriginalFilename
();
// 讲当前文件内容传输到目标文件
try
{
File
file1
=
new
File
(
path
);
if
(!
file1
.
exists
())
{
file1
.
mkdirs
();
}
file
.
transferTo
(
file1
);
}
catch
(
IOException
e
)
{
return
RestBean
.
failure
(
ServiceCode
.
ERROR_UNKNOWN
);
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"videoSrcUrl"
,
path
);
map
.
put
(
"userID"
,
principal
.
getUserID
());
// map.put("username", principal.getUsername());
return
RestBean
.
success
(
map
);
}
}
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/video/uplaod/video.md
已删除
100644 → 0
浏览文件 @
9e17c6ca
### 视频模块
\ No newline at end of file
youbili-project-backend/src/main/resources/application.yaml
浏览文件 @
593b604a
#端口号
server
:
port
:
8089
port
:
10001
# Servlet(Java用于处理请求的组件)的配置
servlet
:
# 编码配置
...
...
youbili-project-backend/src/main/resources/mapper/user/FollowMapper.xml
浏览文件 @
593b604a
...
...
@@ -26,8 +26,8 @@
AND followedID = #{followedID}
</select>
<select
id=
"selectByUserIDAndFollowID"
resultType=
"
int
"
>
SELECT
COUNT(*)
FROM youbili_v1.follow
<select
id=
"selectByUserIDAndFollowID"
resultType=
"
cn.tedu.youbiliprojectbackend.modules.user.follow.pojo.entity.followedID
"
>
SELECT
followedID
FROM youbili_v1.follow
WHERE followerID=#{userID}
AND followID = #{followID}
</select>
...
...
youbili-project-backend/src/main/resources/mapper/video/VideoCategoryMapper.xml
0 → 100644
浏览文件 @
593b604a
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.tedu.youbiliprojectbackend.modules.video.uplaod.dao.mapper.AddCategoryMapper"
>
<insert
id=
"insertCategory"
>
INSERT INTO videocategory (videoID, categoryID)
values (#{videoID}, #{categoryID})
</insert>
</mapper>
\ No newline at end of file
youbili-project-backend/src/main/resources/mapper/video/VideoTagMapper.xml
0 → 100644
浏览文件 @
593b604a
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.tedu.youbiliprojectbackend.modules.video.uplaod.dao.mapper.AddTagMapper"
>
<insert
id=
"insertTag"
>
INSERT INTO videotag (videoID, tagID) values (#{videoID}, #{tagID})
</insert>
</mapper>
\ No newline at end of file
youbili-project-backend/src/main/resources/mapper/video/VideoUploadMapper.xml
0 → 100644
浏览文件 @
593b604a
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.tedu.youbiliprojectbackend.modules.video.uplaod.dao.mapper.VideoUploadMapper"
>
<insert
id=
"insertVideoContent"
useGeneratedKeys=
"true"
keyProperty=
"videoID"
>
INSERT INTO video (userID, title, description, videoSrcUrl,videoImgUrl)
values (#{userID}, #{title}, #{description}, #{videoSrcUrl}, #{videoImgUrl})
</insert>
</mapper>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录