Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
a2b62a0c
Commit
a2b62a0c
authored
Aug 02, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
内容超长error fix
parent
0d64e1bf
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+11
-7
TencentcloudUtils.java
...main/java/com/tanpu/community/util/TencentcloudUtils.java
+0
-1
No files found.
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
a2b62a0c
...
@@ -517,16 +517,20 @@ public class ThemeManager {
...
@@ -517,16 +517,20 @@ public class ThemeManager {
String
content
=
sb
.
toString
();
String
content
=
sb
.
toString
();
// 腾讯云接口最多支持5000文字校验,超过5000执行2次
// 腾讯云接口最多支持5000文字校验,超过5000执行2次
// 检查内容是否涉黄违法
// 检查内容是否涉黄违法
boolean
b
=
TencentcloudUtils
.
textModeration
(
content
.
length
()
>
5000
?
content
.
substring
(
0
,
5000
)
:
content
);
boolean
b
;
while
(
content
.
length
()>
5000
){
b
=
TencentcloudUtils
.
textModeration
(
content
.
substring
(
0
,
5000
));
if
(!
b
)
{
if
(!
b
)
{
throw
new
BizException
(
ErrorCodeConstant
.
CONTENT_ILLEGAL
);
throw
new
BizException
(
ErrorCodeConstant
.
CONTENT_ILLEGAL
);
}
}
if
(
content
.
length
()
>
5000
)
{
content
=
content
.
substring
(
5000
);
boolean
result
=
TencentcloudUtils
.
textModeration
(
content
.
substring
(
5000
,
content
.
length
()));
if
(!
result
)
{
throw
new
BizException
(
ErrorCodeConstant
.
CONTENT_ILLEGAL
);
}
}
b
=
TencentcloudUtils
.
textModeration
(
content
);
if
(!
b
)
{
throw
new
BizException
(
ErrorCodeConstant
.
CONTENT_ILLEGAL
);
}
}
}
}
...
...
community-service/src/main/java/com/tanpu/community/util/TencentcloudUtils.java
View file @
a2b62a0c
...
@@ -88,7 +88,6 @@ public class TencentcloudUtils {
...
@@ -88,7 +88,6 @@ public class TencentcloudUtils {
// suggestion Block 不通过
// suggestion Block 不通过
if
(
res
.
getSuggestion
().
equals
(
"Block"
))
{
if
(
res
.
getSuggestion
().
equals
(
"Block"
))
{
return
false
;
return
false
;
// return CommonResp.error(CommonResp.CONTENT_ILLEGAL, getTextLabel(res.getLabel(), res.getKeywords()));
}
}
}
catch
(
TencentCloudSDKException
e
)
{
}
catch
(
TencentCloudSDKException
e
)
{
log
.
error
(
"调用腾文本内容安全异常"
);
log
.
error
(
"调用腾文本内容安全异常"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment