Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
saturn
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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpha
saturn
Commits
6e07d665
Commit
6e07d665
authored
Jul 04, 2019
by
王浩
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'haow/hotfix' into 'master'
add check sensitive in topic crawl from app See merge request
!69
parents
4c15a57a
2cfc4b5b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
reply.py
api/views/reply.py
+18
-1
topic.py
api/views/topic.py
+8
-1
No files found.
api/views/reply.py
View file @
6e07d665
import
json
from
api.views.base_view
import
BaseView
from
alpha_types.venus.enum
import
REPLY_TYPE
from
api.utils.sensitive
import
Sensitive
class
CreateReplyForInner
(
BaseView
):
"""
内部使用,创建评论回复
"""
def
check_sensitive_content
(
self
,
content
):
# 敏感词检测,获取可用的帖子
check_info
=
Sensitive
.
check
([
content
])
succ
=
check_info
.
get
(
content
)
if
not
succ
:
return
content
else
:
return
def
post
(
self
,
request
):
user_id
=
request
.
POST
.
get
(
'user_id'
)
topic_id
=
request
.
POST
.
get
(
'topic_id'
)
content
=
request
.
POST
.
get
(
'content'
,
''
)
replied_id
=
request
.
POST
.
get
(
'replied_id'
)
reply_type
=
request
.
POST
.
get
(
'type'
,
REPLY_TYPE
.
PUPPET_REPLY
)
if
reply_type
not
in
(
REPLY_TYPE
.
PUPPET_REPLY
,
REPLY_TYPE
.
PUPPET_REPLY_ANS
):
if
not
self
.
check_sensitive_content
(
content
):
return
error
,
data
=
self
.
call_rpc
(
'venus/community/reply/for_inner_create'
,
user_id
=
user_id
,
topic_id
=
topic_id
,
content
=
content
,
replied_id
=
replied_id
)
error
,
data
=
self
.
call_rpc
(
'venus/community/reply/for_inner_create'
,
user_id
=
user_id
,
topic_id
=
topic_id
,
content
=
content
,
replied_id
=
replied_id
,
reply_type
=
reply_type
)
if
error
:
return
self
.
error
(
error
)
...
...
api/views/topic.py
View file @
6e07d665
...
...
@@ -123,6 +123,8 @@ class CreateTopicForBatch(BaseView):
topic_list
=
json
.
loads
(
request
.
POST
.
get
(
"topic_list"
,
'[]'
))
pictorial_tag_ids
=
json
.
loads
(
request
.
POST
.
get
(
"tag_ids"
,
'[]'
))
is_app
=
request
.
POST
.
get
(
'is_app'
,
None
)
info_logger
.
info
({
'user_id'
:
user_id
,
'card_level'
:
card_level
,
...
...
@@ -144,7 +146,12 @@ class CreateTopicForBatch(BaseView):
return
self
.
ok
()
# 敏感词检测,获取可用的帖子
# checked_topics = self.check_sensitive_content(topic_list)
if
is_app
:
if
int
(
is_app
)
==
1
:
checked_topics
=
self
.
check_sensitive_content
(
topic_list
)
else
:
checked_topics
=
topic_list
else
:
checked_topics
=
topic_list
topics
=
[]
...
...
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