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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
22 deletions
+19
-22
pictorial.py
api/views/pictorial.py
+19
-22
No files found.
api/views/pictorial.py
View file @
6503941f
...
@@ -85,38 +85,33 @@ class CreatePictorial(BaseView):
...
@@ -85,38 +85,33 @@ class CreatePictorial(BaseView):
)
)
return
ret
return
ret
def
revise_comments
(
self
,
comment
s
,
from_id
):
def
revise_comments
(
self
,
comment
,
from_id
):
ret
=
[]
ret
=
[]
for
obj
in
comments
:
comment
[
'from_id'
]
=
from_id
obj
[
'from_id'
]
=
from_id
comment
[
'content'
]
=
comment
.
get
(
'comment'
)
obj
[
'content'
]
=
obj
.
get
(
'comment'
)
reply
=
comment
.
pop
(
'reply'
,
None
)
reply
=
obj
.
pop
(
'reply'
,
None
)
if
not
reply
:
if
not
reply
:
return
comment
,
ret
continue
for
info
in
reply
:
for
info
in
reply
:
info
[
'from_id'
]
=
comment
.
get
(
'from_id'
)
info
[
'from_id'
]
=
obj
.
get
(
'from_id'
)
info
[
'reply_id'
]
=
comment
.
get
(
'id'
)
info
[
'reply_id'
]
=
obj
.
get
(
'id'
)
info
[
'type'
]
=
comment
.
get
(
'type'
)
info
[
'type'
]
=
obj
.
get
(
'type'
)
ret
.
append
(
info
)
ret
.
append
(
info
)
return
comment
,
ret
return
obj
,
ret
def
create_comment
(
self
,
comment_list
,
from_id
,
platform
,
topic_id
=
None
,
pictorial_id
=
None
):
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
,
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
[
'user_id'
]
=
self
.
get_user_id
(
id_
=
top_comment
.
get
(
'user'
)
.
get
(
'id'
),
platform
=
platform
)
top_comment
.
pop
(
'user'
)
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
)
error
,
ret
=
self
.
call_rpc
(
'venus/community/crawl/replys'
,
data
=
[
top_comment
],
platform
=
platform
,
topic_id
=
topic_id
,
pictorial_id
=
pictorial_id
)
if
error
:
if
error
:
return
error
,
ret
return
error
,
ret
top_id
=
ret
.
get
(
'reply_ids'
)[
0
]
top_id
=
ret
.
get
(
'reply_ids'
)[
0
]
top_id
=
0
for
obj
in
comments
:
for
obj
in
comments
:
obj
[
'user_id'
]
=
self
.
get_user_id
(
id_
=
obj
.
get
(
'user'
)
.
get
(
'id'
),
platform
=
platform
)
obj
[
'user_id'
]
=
self
.
get_user_id
(
id_
=
obj
.
get
(
'user'
)
.
get
(
'id'
),
platform
=
platform
)
obj
.
pop
(
'user'
)
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
)
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
:
if
error
:
return
error
,
None
return
error
,
None
...
@@ -135,7 +130,8 @@ class CreatePictorial(BaseView):
...
@@ -135,7 +130,8 @@ class CreatePictorial(BaseView):
continue
continue
from_id
=
topic
.
get
(
'id'
)
from_id
=
topic
.
get
(
'id'
)
if
platform
==
GRAP_PLATFORM
.
XIAOHONGSHU
:
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
:
if
error
:
return
error
,
_
return
error
,
_
...
@@ -180,9 +176,10 @@ class CreatePictorial(BaseView):
...
@@ -180,9 +176,10 @@ class CreatePictorial(BaseView):
return
error
,
None
return
error
,
None
if
pictorial_comments
:
if
pictorial_comments
:
if
platform
==
GRAP_PLATFORM
.
XIAOHONGSHU
:
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
:
if
error
:
error
,
_
=
self
.
create_comment
(
comment_list
=
pictorial_comment
,
from_id
=
pictorial
.
get
(
'id'
),
platform
=
platform
,
pictorial_id
=
pictorial_id
)
return
error
,
_
if
error
:
return
error
,
_
return
None
,
None
return
None
,
None
...
...
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