Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringBoot-kwan
提交
6041f44d
S
SpringBoot-kwan
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
SpringBoot-kwan
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringBoot-kwan
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
6041f44d
编写于
10月 25, 2023
作者:
Kwan的解忧杂货铺@新空间代码工作室
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:评论限制规避
上级
f7f69bac
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
5 deletion
+33
-5
src/main/java/com/kwan/springbootkwan/enums/CommentStatus.java
...ain/java/com/kwan/springbootkwan/enums/CommentStatus.java
+8
-0
src/main/java/com/kwan/springbootkwan/service/impl/CsdnCommentServiceImpl.java
...n/springbootkwan/service/impl/CsdnCommentServiceImpl.java
+9
-1
src/main/java/com/kwan/springbootkwan/service/impl/CsdnServiceImpl.java
...com/kwan/springbootkwan/service/impl/CsdnServiceImpl.java
+16
-4
未找到文件。
src/main/java/com/kwan/springbootkwan/enums/CommentStatus.java
浏览文件 @
6041f44d
...
@@ -26,6 +26,14 @@ public enum CommentStatus {
...
@@ -26,6 +26,14 @@ public enum CommentStatus {
* 评论太快
* 评论太快
*/
*/
COMMENT_TOO_FAST
(
4
,
"评论太快"
),
COMMENT_TOO_FAST
(
4
,
"评论太快"
),
/**
* 评论已经到了49条
*/
COMMENT_NUM_49
(
5
,
"评论已经到了49条"
),
/**
* 其他错误
*/
OTHER_ERRORS
(
8
,
"其他错误"
),
/**
/**
* 评论成功
* 评论成功
*/
*/
...
...
src/main/java/com/kwan/springbootkwan/service/impl/CsdnCommentServiceImpl.java
浏览文件 @
6041f44d
...
@@ -95,9 +95,17 @@ public class CsdnCommentServiceImpl implements CsdnCommentService {
...
@@ -95,9 +95,17 @@ public class CsdnCommentServiceImpl implements CsdnCommentService {
}
else
if
(
code
==
400
&&
message
.
contains
(
"因存在恶意评论嫌疑,您的账号已被禁言"
))
{
}
else
if
(
code
==
400
&&
message
.
contains
(
"因存在恶意评论嫌疑,您的账号已被禁言"
))
{
log
.
info
(
"因存在恶意评论嫌疑,您的账号已被禁言"
);
log
.
info
(
"因存在恶意评论嫌疑,您的账号已被禁言"
);
csdnUserInfo
.
setCommentStatus
(
CommentStatus
.
RESTRICTED_COMMENTS
.
getCode
());
csdnUserInfo
.
setCommentStatus
(
CommentStatus
.
RESTRICTED_COMMENTS
.
getCode
());
}
else
{
}
else
if
(
code
==
400
&&
StringUtils
.
equals
(
message
,
"您评论太快了,请休息一下!"
))
{
log
.
info
(
"您评论太快了,请休息一下!"
);
log
.
info
(
"您评论太快了,请休息一下!"
);
csdnUserInfo
.
setCommentStatus
(
CommentStatus
.
COMMENT_TOO_FAST
.
getCode
());
csdnUserInfo
.
setCommentStatus
(
CommentStatus
.
COMMENT_TOO_FAST
.
getCode
());
try
{
Thread
.
sleep
(
20000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
else
{
log
.
info
(
"其他错误"
);
csdnUserInfo
.
setCommentStatus
(
CommentStatus
.
OTHER_ERRORS
.
getCode
());
}
}
return
true
;
return
true
;
}
}
...
...
src/main/java/com/kwan/springbootkwan/service/impl/CsdnServiceImpl.java
浏览文件 @
6041f44d
...
@@ -8,6 +8,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
...
@@ -8,6 +8,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.kwan.springbootkwan.entity.CsdnUserInfo
;
import
com.kwan.springbootkwan.entity.CsdnUserInfo
;
import
com.kwan.springbootkwan.entity.resp.BusinessInfoResponse
;
import
com.kwan.springbootkwan.entity.resp.BusinessInfoResponse
;
import
com.kwan.springbootkwan.enums.CommentStatus
;
import
com.kwan.springbootkwan.service.CsdnCollectService
;
import
com.kwan.springbootkwan.service.CsdnCollectService
;
import
com.kwan.springbootkwan.service.CsdnCommentService
;
import
com.kwan.springbootkwan.service.CsdnCommentService
;
import
com.kwan.springbootkwan.service.CsdnLikeService
;
import
com.kwan.springbootkwan.service.CsdnLikeService
;
...
@@ -62,10 +63,21 @@ public class CsdnServiceImpl implements CsdnService {
...
@@ -62,10 +63,21 @@ public class CsdnServiceImpl implements CsdnService {
if
(!
isLike
)
{
if
(!
isLike
)
{
csdnLikeService
.
like
(
articleId
,
csdnUserInfo
);
csdnLikeService
.
like
(
articleId
,
csdnUserInfo
);
}
}
//评论
//查看已经评论总数量
final
Boolean
comment
=
csdnCommentService
.
isComment
(
article
,
csdnUserInfo
);
QueryWrapper
<
CsdnUserInfo
>
wrapper
=
new
QueryWrapper
<>();
if
(!
comment
)
{
wrapper
.
eq
(
"is_delete"
,
0
);
csdnCommentService
.
comment
(
articleId
,
csdnUserInfo
);
wrapper
.
eq
(
"comment_status"
,
9
);
final
List
<
CsdnUserInfo
>
comments
=
csdnUserInfoService
.
list
(
wrapper
);
if
(
CollectionUtil
.
isNotEmpty
(
comments
))
{
if
(
comments
.
size
()
>=
49
)
{
csdnUserInfo
.
setCommentStatus
(
CommentStatus
.
COMMENT_NUM_49
.
getCode
());
}
else
{
//评论
final
Boolean
comment
=
csdnCommentService
.
isComment
(
article
,
csdnUserInfo
);
if
(!
comment
)
{
csdnCommentService
.
comment
(
articleId
,
csdnUserInfo
);
}
}
}
}
//收藏
//收藏
final
Boolean
collect
=
csdnCollectService
.
isCollect
(
articleId
,
csdnUserInfo
);
final
Boolean
collect
=
csdnCollectService
.
isCollect
(
articleId
,
csdnUserInfo
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录