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
0
Merge Requests
0
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
赵磊
saturn
Commits
faf7b6f7
Commit
faf7b6f7
authored
Apr 03, 2019
by
杨成林
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ycl/location_test' into 'test'
location See merge request
alpha/saturn!38
parents
4b6e0c84
bae7b38b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
tag.py
api/views/tag.py
+1
-1
topic.py
api/views/topic.py
+19
-4
No files found.
api/views/tag.py
View file @
faf7b6f7
...
...
@@ -19,7 +19,7 @@ class CreateTagForBatch(BaseView):
for
tag
in
tag_list
:
succ
=
check_info
.
get
(
tag
.
get
(
"name"
))
if
tag
.
get
(
"name"
)
else
True
if
not
succ
:
tags
.
append
(
tag
)
tags
.
append
(
{
"name"
:
tag
}
)
else
:
tags
=
tag_list
error
,
data
=
self
.
call_rpc
(
'venus/community/tag/batch_create_not_classify'
,
data
=
tags
)
...
...
api/views/topic.py
View file @
faf7b6f7
...
...
@@ -57,6 +57,7 @@ class CreateTopicForBatch(BaseView):
if
not
topics
:
return
self
.
ok
()
locations
=
[]
tag_names
=
[]
for
item
in
topics
:
tags
=
item
.
get
(
"tags"
)
or
[]
...
...
@@ -65,6 +66,11 @@ class CreateTopicForBatch(BaseView):
item
[
"card_level"
]
=
card_level
item
[
"tag_id"
]
=
tag_id
if
tag_id
else
None
item
[
"is_online"
]
=
is_online
if
item
.
get
(
"location"
)
and
item
.
get
(
"location"
)
.
get
(
"name"
):
locations
.
append
({
"name"
:
item
.
get
(
"location"
)
.
get
(
"name"
),
"is_location"
:
True
})
not_exists_ids
=
[]
topic_list
=
[]
...
...
@@ -92,12 +98,17 @@ class CreateTopicForBatch(BaseView):
# check_info = Sensitive.check(tag_names)
# tags = [tag_name for tag_name, succ in check_info.items() if not succ]
tags
=
tag_names
tags
=
[{
"name"
:
item
,
"is_own"
:
True
,
}
for
item
in
tag_names
]
tags
.
extend
(
locations
)
# 先创建标签
_tag_error
,
_tag_data
=
self
.
call_rpc
(
"venus/community/tag/batch_create_tag_by_name"
,
tag
_names
=
tags
,
is_own
=
1
tag
s
=
tags
)
if
_tag_error
:
return
self
.
error
(
_tag_error
)
...
...
@@ -107,6 +118,10 @@ class CreateTopicForBatch(BaseView):
for
item
in
topic_list
:
tags
=
item
.
get
(
"tags"
)
or
[]
tags
=
[
tag
.
replace
(
"#"
,
''
)
.
strip
()
for
tag
in
tags
]
#添加地域标签
if
item
.
get
(
"location"
)
and
item
.
get
(
"location"
)
.
get
(
"name"
):
tags
.
append
(
item
.
get
(
"location"
)
.
get
(
"name"
))
content
=
item
[
"content"
]
for
tag_name
,
tag_id
in
_tag_data
.
items
():
if
tag_name
in
tags
:
...
...
@@ -181,12 +196,12 @@ class CreateTopicForBatchByOne(BaseView):
# check_info = Sensitive.check(tag_names)
# tags = [tag_name for tag_name, succ in check_info.items() if not succ]
# check_info = Sensitive.check(tag_names)
tags
=
tag_names
tags
=
[{
"name"
:
item
}
for
item
in
tag_names
]
# 先创建标签
_tag_error
,
_tag_data
=
self
.
call_rpc
(
"venus/community/tag/batch_create_tag_by_name"
,
tag
_name
s
=
tags
tags
=
tags
)
if
_tag_error
:
return
self
.
error
(
_tag_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