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
2bd1ddbf
Commit
2bd1ddbf
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!90
parents
075b6289
6eac5896
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
pictorial.py
api/views/pictorial.py
+6
-6
No files found.
api/views/pictorial.py
View file @
2bd1ddbf
...
...
@@ -34,7 +34,6 @@ class CreatePictorial(BaseView):
def
get_user_id
(
self
,
id_
,
platform
):
cache_key
=
'grap:{}:{}'
.
format
(
platform
,
id_
)
exist_key
=
'grap:{}:{}'
# print(cache_key)
value
=
ins_cache
.
get
(
cache_key
)
user_id
=
None
if
not
value
:
...
...
@@ -107,21 +106,22 @@ class CreatePictorial(BaseView):
error
,
topic_obj
=
self
.
call_rpc
(
'venus/community/crawl/topic'
,
data
=
topic
,
platform
=
platform
,
pictorial_id
=
None
)
if
error
:
self
.
del_cache
()
return
self
.
error
(
error
=
error
)
return
error
,
_
if
not
topic_comments
:
continue
from_id
=
topic
.
get
(
'id'
)
if
platform
==
GRAP_PLATFORM
.
XIAOHONGSHU
:
topic_comments
=
self
.
revise_comments
(
topic_comments
,
from_id
)
for
obj
in
topic_comments
:
obj
[
'user_id'
]
=
self
.
get_user_id
(
id_
=
obj
.
get
(
'id'
),
platform
=
platform
)
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
=
topic_comments
,
platform
=
platform
,
topic_id
=
topic_obj
.
get
(
'id'
))
if
error
:
self
.
del_cache
()
return
self
.
error
(
error
=
error
)
return
error
,
_
self
.
del_cache
()
return
return
None
,
None
def
create_pictorial
(
self
,
pictorial
,
platform
):
topics
=
[]
...
...
@@ -166,7 +166,7 @@ class CreatePictorial(BaseView):
if
platform
==
GRAP_PLATFORM
.
XIAOHONGSHU
:
pictorial_comments
=
self
.
revise_comments
(
pictorial_comments
,
pictorial
.
get
(
'id'
))
for
obj
in
pictorial_comments
:
obj
[
'user_id'
]
=
self
.
get_user_id
(
id_
=
obj
.
get
(
'id'
),
platform
=
platform
)
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
=
pictorial_comments
,
platform
=
platform
,
pictorial_id
=
pictorial_id
)
...
...
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