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
00268486
Commit
00268486
authored
Feb 26, 2019
by
王浩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify batch create tag and topic
parent
59618e60
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
tag.py
api/views/tag.py
+8
-6
topic.py
api/views/topic.py
+1
-1
No files found.
api/views/tag.py
View file @
00268486
...
@@ -10,14 +10,16 @@ class CreateTagForBatch(BaseView):
...
@@ -10,14 +10,16 @@ class CreateTagForBatch(BaseView):
"""
"""
def
post
(
self
,
request
):
def
post
(
self
,
request
):
tag_list
=
json
.
loads
(
request
.
POST
.
get
(
"tags"
,
'[]'
))
tag_list
=
json
.
loads
(
request
.
POST
.
get
(
"tags"
,
'[]'
))
need_check
=
request
.
POST
.
get
(
'need_check'
,
1
)
tags
=
[]
tags
=
[]
# 敏感词检测,获取可用的帖子
if
need_check
:
check_info
=
Sensitive
.
check
([
item
[
"name"
]
for
item
in
tag_list
if
item
.
get
(
"name"
)])
# 敏感词检测,获取可用的帖子
for
tag
in
tag_list
:
check_info
=
Sensitive
.
check
([
item
[
"name"
]
for
item
in
tag_list
if
item
.
get
(
"name"
)])
succ
=
check_info
.
get
(
tag
.
get
(
"name"
))
if
tag
.
get
(
"name"
)
else
True
for
tag
in
tag_list
:
if
not
succ
:
succ
=
check_info
.
get
(
tag
.
get
(
"name"
))
if
tag
.
get
(
"name"
)
else
True
tags
.
append
(
tag
)
if
not
succ
:
tags
.
append
(
tag
)
error
,
data
=
self
.
call_rpc
(
'venus/community/tag/batch_create_not_classify'
,
data
=
tags
)
error
,
data
=
self
.
call_rpc
(
'venus/community/tag/batch_create_not_classify'
,
data
=
tags
)
...
...
api/views/topic.py
View file @
00268486
...
@@ -49,7 +49,7 @@ class CreateTopicForBatch(BaseView):
...
@@ -49,7 +49,7 @@ class CreateTopicForBatch(BaseView):
tag_names
.
extend
([
tag
.
replace
(
"#"
,
''
)
.
strip
()
for
tag
in
tags
])
tag_names
.
extend
([
tag
.
replace
(
"#"
,
''
)
.
strip
()
for
tag
in
tags
])
item
[
"user_id"
]
=
user_id
item
[
"user_id"
]
=
user_id
item
[
"card_level"
]
=
card_level
item
[
"card_level"
]
=
card_level
item
[
"tag_id"
]
=
tag_id
item
[
"tag_id"
]
=
tag_id
if
tag_id
else
None
item
[
"is_online"
]
=
is_online
item
[
"is_online"
]
=
is_online
check_info
=
Sensitive
.
check
(
tag_names
)
check_info
=
Sensitive
.
check
(
tag_names
)
...
...
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