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
6503941f
Commit
6503941f
authored
Aug 09, 2019
by
王浩
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'haow/dev' into 'test'
fix code See merge request
alpha/saturn!96
parents
b69c89e0
f47dfb70
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
16 deletions
+13
-16
pictorial.py
api/views/pictorial.py
+13
-16
No files found.
api/views/pictorial.py
View file @
6503941f
...
...
@@ -85,38 +85,33 @@ class CreatePictorial(BaseView):
)
return
ret
def
revise_comments
(
self
,
comment
s
,
from_id
):
def
revise_comments
(
self
,
comment
,
from_id
):
ret
=
[]
for
obj
in
comments
:
obj
[
'from_id'
]
=
from_id
obj
[
'content'
]
=
obj
.
get
(
'comment'
)
reply
=
obj
.
pop
(
'reply'
,
None
)
comment
[
'from_id'
]
=
from_id
comment
[
'content'
]
=
comment
.
get
(
'comment'
)
reply
=
comment
.
pop
(
'reply'
,
None
)
if
not
reply
:
continue
return
comment
,
ret
for
info
in
reply
:
info
[
'from_id'
]
=
obj
.
get
(
'from_id'
)
info
[
'reply_id'
]
=
obj
.
get
(
'id'
)
info
[
'type'
]
=
obj
.
get
(
'type'
)
info
[
'from_id'
]
=
comment
.
get
(
'from_id'
)
info
[
'reply_id'
]
=
comment
.
get
(
'id'
)
info
[
'type'
]
=
comment
.
get
(
'type'
)
ret
.
append
(
info
)
return
obj
,
ret
return
comment
,
ret
def
create_comment
(
self
,
comment_list
,
from_id
,
platform
,
topic_id
=
None
,
pictorial_id
=
None
):
top_comment
,
comments
=
self
.
revise_comments
(
comment_list
,
from_id
)
top_comment
[
'user_id'
]
=
self
.
get_user_id
(
id_
=
top_comment
.
get
(
'user'
)
.
get
(
'id'
),
platform
=
platform
)
top_comment
.
pop
(
'user'
)
error
,
ret
=
self
.
call_rpc
(
'venus/community/crawl/replys'
,
data
=
[
top_comment
],
platform
=
platform
,
topic_id
=
topic_id
,
pictorial_id
=
pictorial_id
)
if
error
:
return
error
,
ret
top_id
=
ret
.
get
(
'reply_ids'
)[
0
]
top_id
=
0
for
obj
in
comments
:
obj
[
'user_id'
]
=
self
.
get_user_id
(
id_
=
obj
.
get
(
'user'
)
.
get
(
'id'
),
platform
=
platform
)
obj
.
pop
(
'user'
)
error
,
_
=
self
.
call_rpc
(
'venus/community/crawl/replys'
,
data
=
comments
,
platform
=
platform
,
topic_id
=
topic_id
,
pictorial_id
=
pictorial_id
,
top_id
=
top_id
)
if
error
:
return
error
,
None
...
...
@@ -135,7 +130,8 @@ class CreatePictorial(BaseView):
continue
from_id
=
topic
.
get
(
'id'
)
if
platform
==
GRAP_PLATFORM
.
XIAOHONGSHU
:
error
,
_
=
self
.
create_comment
(
comment_list
=
topic_comments
,
from_id
=
from_id
,
platform
=
platform
,
topic_id
=
topic_obj
.
get
(
'id'
))
for
topic_comment
in
topic_comments
:
error
,
_
=
self
.
create_comment
(
comment_list
=
topic_comment
,
from_id
=
from_id
,
platform
=
platform
,
topic_id
=
topic_obj
.
get
(
'id'
))
if
error
:
return
error
,
_
...
...
@@ -180,7 +176,8 @@ class CreatePictorial(BaseView):
return
error
,
None
if
pictorial_comments
:
if
platform
==
GRAP_PLATFORM
.
XIAOHONGSHU
:
error
,
_
=
self
.
create_comment
(
comment_list
=
pictorial_comments
,
from_id
=
pictorial
.
get
(
'id'
),
platform
=
platform
,
pictorial_id
=
pictorial_id
)
for
pictorial_comment
in
pictorial_comments
:
error
,
_
=
self
.
create_comment
(
comment_list
=
pictorial_comment
,
from_id
=
pictorial
.
get
(
'id'
),
platform
=
platform
,
pictorial_id
=
pictorial_id
)
if
error
:
return
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