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
02f63f7e
Commit
02f63f7e
authored
6 years ago
by
王浩
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'haow/pin_crawl' into 'test'
add pictorial tag ids See merge request
!53
parents
eef6be89
c7a64803
master
deploy/like-prod
deploy/like-stage
deploy/like-test
dev
like-pre/r01
test
2 merge requests
!79
Haow/dev
,
!57
Test
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
topic.py
api/views/topic.py
+5
-5
No files found.
api/views/topic.py
View file @
02f63f7e
...
@@ -25,6 +25,7 @@ class CreateTopicForBatch(BaseView):
...
@@ -25,6 +25,7 @@ class CreateTopicForBatch(BaseView):
is_online
=
request
.
POST
.
get
(
"is_online"
,
0
)
is_online
=
request
.
POST
.
get
(
"is_online"
,
0
)
platform
=
int
(
request
.
POST
.
get
(
"platform"
))
platform
=
int
(
request
.
POST
.
get
(
"platform"
))
topic_list
=
json
.
loads
(
request
.
POST
.
get
(
"topic_list"
,
'[]'
))
topic_list
=
json
.
loads
(
request
.
POST
.
get
(
"topic_list"
,
'[]'
))
pictorial_tag_ids
=
json
.
loads
(
request
.
POST
.
get
(
"tag_ids"
,
'[]'
))
if
not
user_id
:
if
not
user_id
:
return
self
.
parameter_invalid_response
()
return
self
.
parameter_invalid_response
()
...
@@ -66,6 +67,7 @@ class CreateTopicForBatch(BaseView):
...
@@ -66,6 +67,7 @@ class CreateTopicForBatch(BaseView):
item
[
"card_level"
]
=
card_level
item
[
"card_level"
]
=
card_level
item
[
"tag_id"
]
=
tag_id
if
tag_id
else
None
item
[
"tag_id"
]
=
tag_id
if
tag_id
else
None
item
[
"is_online"
]
=
is_online
item
[
"is_online"
]
=
is_online
item
[
"pictorial_tag_ids"
]
=
pictorial_tag_ids
if
item
.
get
(
"location"
)
and
item
.
get
(
"location"
)
.
get
(
"name"
):
if
item
.
get
(
"location"
)
and
item
.
get
(
"location"
)
.
get
(
"name"
):
_tag_error
,
_location_tag_data
=
self
.
call_rpc
(
_tag_error
,
_location_tag_data
=
self
.
call_rpc
(
"venus/community/tag/batch_create_tag_by_name"
,
"venus/community/tag/batch_create_tag_by_name"
,
...
@@ -112,9 +114,7 @@ class CreateTopicForBatch(BaseView):
...
@@ -112,9 +114,7 @@ class CreateTopicForBatch(BaseView):
)
)
if
_tag_error
:
if
_tag_error
:
return
self
.
error
(
_tag_error
)
return
self
.
error
(
_tag_error
)
#_tag_data.update(location_tags)
for
item
in
location_tags
:
_tag_data
.
update
(
item
)
# 更新发帖
# 更新发帖
# 处理标签,将文本中的标签处理成现有标签
# 处理标签,将文本中的标签处理成现有标签
...
@@ -125,7 +125,7 @@ class CreateTopicForBatch(BaseView):
...
@@ -125,7 +125,7 @@ class CreateTopicForBatch(BaseView):
#添加地域标签
#添加地域标签
if
item
.
get
(
"location"
)
and
item
.
get
(
"location"
)
.
get
(
"name"
):
if
item
.
get
(
"location"
)
and
item
.
get
(
"location"
)
.
get
(
"name"
):
tags
.
append
(
item
.
get
(
"location"
)
.
get
(
"name"
))
tags
.
append
(
item
.
get
(
"location"
)
.
get
(
"name"
))
content
=
item
[
"content"
]
content
=
item
.
get
(
"content"
)
for
tag_name
,
tag_id
in
_tag_data
.
items
():
for
tag_name
,
tag_id
in
_tag_data
.
items
():
if
tag_name
in
tags
:
if
tag_name
in
tags
:
alpha_tag
=
'<topic>{'
+
'"id":{},"name":"{}"'
.
format
(
tag_id
,
tag_name
)
+
'}</topic>'
alpha_tag
=
'<topic>{'
+
'"id":{},"name":"{}"'
.
format
(
tag_id
,
tag_name
)
+
'}</topic>'
...
@@ -213,7 +213,7 @@ class CreateTopicForBatchByOne(BaseView):
...
@@ -213,7 +213,7 @@ class CreateTopicForBatchByOne(BaseView):
for
item
in
need_create_topics
:
for
item
in
need_create_topics
:
tags
=
item
.
get
(
"tags"
)
or
[]
tags
=
item
.
get
(
"tags"
)
or
[]
tags
=
[
tag
.
replace
(
"#"
,
''
)
.
strip
()
for
tag
in
tags
]
tags
=
[
tag
.
replace
(
"#"
,
''
)
.
strip
()
for
tag
in
tags
]
content
=
item
[
"content"
]
content
=
item
.
get
(
"content"
)
for
tag_name
,
tag_id
in
_tag_data
.
items
():
for
tag_name
,
tag_id
in
_tag_data
.
items
():
if
tag_name
in
tags
:
if
tag_name
in
tags
:
alpha_tag
=
'<topic>{'
+
'"id":{},"name":"{}"'
.
format
(
tag_id
,
tag_name
)
+
'}</topic>'
alpha_tag
=
'<topic>{'
+
'"id":{},"name":"{}"'
.
format
(
tag_id
,
tag_name
)
+
'}</topic>'
...
...
This diff is collapsed.
Click to expand it.
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