Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
代码敲不队
YoubiliProject
提交
beafcf0c
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 搜索 >>
提交
beafcf0c
编写于
7月 21, 2023
作者:
喷火的神灵
🎱
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
计数模块
上级
99ef7b5d
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
173 addition
and
26 deletion
+173
-26
YouBili_front/public/index.html
YouBili_front/public/index.html
+1
-1
YouBili_front/src/components/Handder.vue
YouBili_front/src/components/Handder.vue
+3
-2
YouBili_front/src/components/sidebar.vue
YouBili_front/src/components/sidebar.vue
+11
-2
YouBili_front/src/utils/option.js
YouBili_front/src/utils/option.js
+27
-0
YouBili_front/src/views/video/videoIndex.vue
YouBili_front/src/views/video/videoIndex.vue
+32
-0
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/core/config/MybatisConfig.java
...tedu/youbiliprojectbackend/core/config/MybatisConfig.java
+2
-1
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/core/config/SecurityConfiguration.java
...biliprojectbackend/core/config/SecurityConfiguration.java
+2
-0
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/favorite/controller/FavoriteController.java
.../modules/user/favorite/controller/FavoriteController.java
+3
-4
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/favorite/dao/cache/FavoriteCacheRepoistory.java
...ules/user/favorite/dao/cache/FavoriteCacheRepoistory.java
+2
-0
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/favorite/dao/cache/impl/FavoriteCacheRepoistoryImpl.java
.../favorite/dao/cache/impl/FavoriteCacheRepoistoryImpl.java
+15
-3
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/favorite/pojo/param/FavoriteParam.java
...ckend/modules/user/favorite/pojo/param/FavoriteParam.java
+35
-0
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/favorite/service/IFavoriteService.java
...ckend/modules/user/favorite/service/IFavoriteService.java
+5
-1
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/favorite/service/impl/FavoriteService.java
...d/modules/user/favorite/service/impl/FavoriteService.java
+19
-12
youbili-project-backend/src/main/resources/mapper/likes/LikeMapper.xml
...ct-backend/src/main/resources/mapper/likes/LikeMapper.xml
+16
-0
未找到文件。
YouBili_front/public/index.html
浏览文件 @
beafcf0c
...
...
@@ -5,7 +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=
"mLogo.png"
>
<title>
<
%=
htmlWebpackPlugin.options.title
%
>
</title>
<title>
YouBili
</title>
</head>
<body>
<noscript>
...
...
YouBili_front/src/components/Handder.vue
浏览文件 @
beafcf0c
...
...
@@ -379,7 +379,7 @@ i {
position
:
fixed
;
top
:
0
;
left
:
0
;
background
:
#fff
;
//
background
:
#fff
;
height
:
60px
;
width
:
100%
;
min-width
:
1200px
;
...
...
@@ -387,6 +387,7 @@ i {
justify-content
:
space-between
;
align-items
:
center
;
z-index
:
99999
;
background-image
:
linear-gradient
(
#feb692
,
#ea5455
);
}
#left
{
...
...
@@ -427,7 +428,7 @@ i {
}
.el-autocomplete
{
width
:
5
80px
;
width
:
6
80px
;
}
.popover
{
...
...
YouBili_front/src/components/sidebar.vue
浏览文件 @
beafcf0c
<!--侧边栏-->
<
template
>
<div>
<div
id=
"mao"
>
<el-menu
id=
"sidebar"
class=
"el-menu-vertical-demo"
:default-active=
"$router.currentRoute.path"
router
v-show=
"isShow"
active-text-color=
"#fe3355"
>
<el-submenu
:index=
"i+''"
v-for=
"(v, i) of themeAll"
:key=
"i"
>
<template
slot=
"title"
>
...
...
@@ -64,8 +65,11 @@ export default {
*
{
padding
:
0
;
margin
:
0
;
color
:
#fff
;
}
#mao
{
}
#sidebar
{
position
:
fixed
;
top
:
60px
;
...
...
@@ -74,14 +78,19 @@ export default {
width
:
250px
;
overflow-y
:
auto
;
border
:
0
;
background-image
:
linear-gradient
(
#fad7a1
,
#e96d71
);
}
#sidebar
.el-menu
{
border
:
0
;
}
ul
.el-menu
.el-menu--inline
{
background-color
:
#000
!important
;
}
.el-menu-item.is-active
{
background
:
#
aaa
!important
;
background
:
#
fad7a1
!important
;
}
a
{
...
...
YouBili_front/src/utils/option.js
浏览文件 @
beafcf0c
...
...
@@ -340,3 +340,30 @@ export function uploadContent(params) {
data
:
params
})
}
// 获取视频页所有数量
export
function
LikeCount
(
params
)
{
return
request
({
method
:
"
get
"
,
url
:
"
/video/all/counts
"
,
data
:
params
})
}
// // 点赞
// export function ForLike(params) {
// return request({
// method: "post",
// url: "/video/handel/like",
// data: params
// })
// }
// 取消点赞
export
function
ForLike
(
params
)
{
return
request
({
method
:
"
post
"
,
url
:
"
/video/handel/removelike
"
,
data
:
params
})
}
\ No newline at end of file
YouBili_front/src/views/video/videoIndex.vue
浏览文件 @
beafcf0c
...
...
@@ -286,6 +286,7 @@ import Sidebar from "@/components/sidebar.vue";
import
MuiPlayer
from
"
mui-player
"
;
import
'
mui-player/dist/mui-player.min.css
'
import
MuiPlayerDesktopPlugin
from
'
./mui-player-desktop-plugin.min
'
import
{
ForLike
}
from
"
@/utils/option
"
;
...
...
@@ -395,6 +396,7 @@ export default {
likeCount
:
1
,
dislikeCount
:
2
,
}
],
},
{
...
...
@@ -578,6 +580,36 @@ export default {
showContentDetail
(
id
)
{
this
.
videoComments
.
find
(
item
=>
item
.
id
==
id
).
isShow
=
true
},
//点赞
// handleLike() {
// ForLike(videoID).then(res => {
// // 如果请求成功,打印响应数据
// console.log(res.data);
// // 显示一个成功的消息
// alert('点赞成功');
// })
// .catch(err => {
// // 如果请求失败,打印错误信息
// console.error(err);
// // 显示一个失败的消息
// alert('点赞失败');
// });
// },
//点赞
// removeLike() {
// deleteLike(likeID).then(res => {
// // 如果请求成功,打印响应数据
// console.log(res.data);
// // 显示一个成功的消息
// alert('点赞成功');
// })
// .catch(err => {
// // 如果请求失败,打印错误信息
// console.error(err);
// // 显示一个失败的消息
// alert('点赞失败');
// });
// },
test
()
{
// 上传pagenum pagesize 住品论id
...
...
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/core/config/MybatisConfig.java
浏览文件 @
beafcf0c
...
...
@@ -24,7 +24,8 @@ import org.springframework.context.annotation.Configuration;
"cn.tedu.youbiliprojectbackend.modules.user.history.dao.mapper"
,
"cn.tedu.youbiliprojectbackend.modules.recommend.mahoutCF.mapper"
,
"cn.tedu.youbiliprojectbackend.common.data.mapper"
,
"cn.tedu.youbiliprojectbackend.modules.user.account.dao.mapper"
"cn.tedu.youbiliprojectbackend.modules.user.account.dao.mapper"
,
"cn.tedu.youbiliprojectbackend.modules.social.like.dao.persist.mapper"
,
})
public
class
MybatisConfig
{
}
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/core/config/SecurityConfiguration.java
浏览文件 @
beafcf0c
...
...
@@ -64,8 +64,10 @@ public class SecurityConfiguration {
// auth.requestMatchers("/alipay/notify");
auth
.
requestMatchers
(
"/alipay/**"
).
permitAll
();
auth
.
requestMatchers
(
"/orders/details/**"
).
permitAll
();
auth
.
requestMatchers
(
"/video/handle/**"
).
permitAll
();
// auth.requestMatchers("/index.html").permitAll();
auth
.
anyRequest
().
authenticated
();
});
/*来禁用跨站请求伪造防御*/
http
.
csrf
(
AbstractHttpConfigurer:
:
disable
);
...
...
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/favorite/controller/FavoriteController.java
浏览文件 @
beafcf0c
...
...
@@ -39,9 +39,9 @@ public class FavoriteController {
*/
@GetMapping
(
"delete"
)
public
RestBean
<
String
>
delete
(
@AuthenticationPrincipal
CurrentPrincipal
currentPrincipal
,
Long
favoriteID
){
Long
favoriteID
,
Long
videoID
){
log
.
debug
(
"开始处理请求: deleteAll"
);
favoriteService
.
deleteById
(
favoriteID
,
currentPrincipal
.
getUserID
());
favoriteService
.
deleteById
(
favoriteID
,
currentPrincipal
.
getUserID
()
,
videoID
);
return
RestBean
.
success
(
"删除成功!"
);
}
...
...
@@ -65,10 +65,9 @@ public class FavoriteController {
* @return 返回
*/
@GetMapping
(
"/add-favorite"
)
public
RestBean
<
String
>
addFavorite
(
@AuthenticationPrincipal
CurrentPrincipal
currentPrincipal
,
Long
videoID
){
public
RestBean
<
String
>
addFavorite
(
@AuthenticationPrincipal
CurrentPrincipal
currentPrincipal
,
Long
videoID
)
{
log
.
debug
(
"开始处理请求 add-favorite"
);
favoriteService
.
insterFavorite
(
currentPrincipal
.
getUserID
(),
videoID
);
return
RestBean
.
success
(
"收藏成功"
);
}
}
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/favorite/dao/cache/FavoriteCacheRepoistory.java
浏览文件 @
beafcf0c
package
cn.tedu.youbiliprojectbackend.modules.user.favorite.dao.cache
;
public
interface
FavoriteCacheRepoistory
{
/**
* 保存
*/
void
save
();
}
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/favorite/dao/cache/impl/FavoriteCacheRepoistoryImpl.java
浏览文件 @
beafcf0c
package
cn.tedu.youbiliprojectbackend.modules.user.favorite.dao.cache.impl
;
import
cn.tedu.youbiliprojectbackend.common.cacheUtils.count.video.pojo.VideoCount
;
import
cn.tedu.youbiliprojectbackend.common.consts.CountConsts
;
import
cn.tedu.youbiliprojectbackend.modules.user.favorite.dao.cache.FavoriteCacheRepoistory
;
import
cn.tedu.youbiliprojectbackend.modules.user.favorite.dao.persist.mapper.FavoriteMapper
;
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
;
@Repository
public
class
FavoriteCacheRepoistoryImpl
implements
FavoriteCacheRepoistory
{
public
class
FavoriteCacheRepoistoryImpl
implements
FavoriteCacheRepoistory
,
CountConsts
{
@Autowired
private
FavoriteMapper
favoriteMapper
;
@Override
public
void
save
()
{
public
void
save
()
{}
}
}
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/favorite/pojo/param/FavoriteParam.java
0 → 100644
浏览文件 @
beafcf0c
package
cn.tedu.youbiliprojectbackend.modules.user.favorite.pojo.param
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
/**
* 取消收藏视频的计数
*/
@Data
public
class
FavoriteParam
{
/**
* 用户ID
*/
private
Long
userID
;
/**
* 视频ID
*/
private
Long
videoID
;
/**
* 启用状态
*/
private
Integer
enable
;
/**
* 收藏总数
*/
private
Integer
favoriteCount
;
/**
* 修改时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
LocalDateTime
gmtModified
;
}
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/favorite/service/IFavoriteService.java
浏览文件 @
beafcf0c
package
cn.tedu.youbiliprojectbackend.modules.user.favorite.service
;
import
cn.tedu.youbiliprojectbackend.modules.user.favorite.pojo.vo.FavoriteVO
;
import
java.util.List
;
...
...
@@ -21,7 +22,10 @@ public interface IFavoriteService {
* @param favoriteID
* @param userID
*/
void
deleteById
(
Long
favoriteID
,
Long
userID
);
void
deleteById
(
Long
favoriteID
,
Long
userID
,
Long
videoID
);
void
insterFavorite
(
Long
userID
,
Long
videoID
);
}
youbili-project-backend/src/main/java/cn/tedu/youbiliprojectbackend/modules/user/favorite/service/impl/FavoriteService.java
浏览文件 @
beafcf0c
...
...
@@ -2,9 +2,12 @@ package cn.tedu.youbiliprojectbackend.modules.user.favorite.service.impl;
import
cn.tedu.youbiliprojectbackend.common.ex.ServiceException
;
import
cn.tedu.youbiliprojectbackend.common.web.response.ServiceCode
;
import
cn.tedu.youbiliprojectbackend.modules.user.favorite.dao.cache.FavoriteCacheRepoistory
;
import
cn.tedu.youbiliprojectbackend.modules.user.favorite.dao.persist.repository.IFavoriteRepository
;
import
cn.tedu.youbiliprojectbackend.modules.user.favorite.pojo.param.FavoriteParam
;
import
cn.tedu.youbiliprojectbackend.modules.user.favorite.pojo.vo.FavoriteVO
;
import
cn.tedu.youbiliprojectbackend.modules.user.favorite.service.IFavoriteService
;
import
cn.tedu.youbiliprojectbackend.modules.video.videocount.dao.cache.VideoCountCacheRepository
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -17,20 +20,22 @@ public class FavoriteService implements IFavoriteService {
@Autowired
IFavoriteRepository
favoriteRepository
;
@Autowired
private
VideoCountCacheRepository
videoCountCacheRepository
;
@Override
public
List
<
FavoriteVO
>
list
(
Long
userID
)
{
List
<
FavoriteVO
>
list
=
null
;
try
{
try
{
list
=
favoriteRepository
.
list
(
userID
);
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
e
.
printStackTrace
();
}
if
(
list
==
null
)
{
throw
new
ServiceException
(
ServiceCode
.
ERROR_CONFLICT
,
"没有查询到响应结果"
);
if
(
list
==
null
)
{
throw
new
ServiceException
(
ServiceCode
.
ERROR_CONFLICT
,
"没有查询到响应结果"
);
}
return
list
;
...
...
@@ -44,19 +49,21 @@ public class FavoriteService implements IFavoriteService {
* @param userID
*/
@Override
public
void
deleteById
(
Long
favoriteID
,
Long
userID
)
{
int
i
=
favoriteRepository
.
deleteById
(
userID
,
favoriteID
);
if
(
i
==
0
)
{
throw
new
ServiceException
(
ServiceCode
.
ERROR_CONFLICT
,
"信息错误!请以正确的形式输入信息"
);
public
void
deleteById
(
Long
favoriteID
,
Long
userID
,
Long
videoID
)
{
int
i
=
favoriteRepository
.
deleteById
(
userID
,
favoriteID
);
if
(
i
==
0
)
{
throw
new
ServiceException
(
ServiceCode
.
ERROR_CONFLICT
,
"信息错误!请以正确的形式输入信息"
);
}
videoCountCacheRepository
.
removeFavoriteCount
(
videoID
);
}
@Override
public
void
insterFavorite
(
Long
userID
,
Long
videoID
)
{
int
i
=
favoriteRepository
.
addFavorite
(
userID
,
videoID
);
if
(
i
!=
1
)
{
throw
new
ServiceException
(
ServiceCode
.
ERROR_CONFLICT
,
"信息错误!请以正确的形式输入信息"
);
int
i
=
favoriteRepository
.
addFavorite
(
userID
,
videoID
);
if
(
i
!=
1
)
{
throw
new
ServiceException
(
ServiceCode
.
ERROR_CONFLICT
,
"信息错误!请以正确的形式输入信息"
);
}
videoCountCacheRepository
.
addFavoriteCount
(
videoID
);
}
}
youbili-project-backend/src/main/resources/mapper/likes/LikeMapper.xml
0 → 100644
浏览文件 @
beafcf0c
<?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.social.like.dao.persist.mapper.LikeMapper"
>
<insert
id=
"insert"
>
INSERT INTO likes(likeID,userID,videoID,likeDate,typeEnable,gmtCreate,gmtModified)
VALUES (#{likeID},#{userID},#{videoID},#{likeDate},#{typeEnable},#{gmtCreate},#{gmtModified})
</insert>
<delete
id=
"delete"
>
DELETE likeID,userID,videoID,likeDate,typeEnable,gmtCreate,gmtModified
FROM youbili_v1.likes
WHERE likeID=#{likeID}
</delete>
</mapper>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录