Commit 2bd1ddbf authored by 王浩's avatar 王浩

Merge branch 'haow/dev' into 'test'

fix code

See merge request alpha/saturn!90
parents 075b6289 6eac5896
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment