Commit 92ecf990 authored by 王浩's avatar 王浩

Merge branch 'haow/dev' into 'test'

fix code

See merge request alpha/saturn!92
parents 4277d290 cd6f01a7
......@@ -105,7 +105,6 @@ class CreatePictorial(BaseView):
topic['user_id'] = self.get_user_id(id_=topic.get('id'), platform=platform)
error, topic_obj = self.call_rpc('venus/community/crawl/topic', data=topic, platform=platform, pictorial_id=None)
if error:
self.del_cache()
return error, _
if not topic_comments:
continue
......@@ -117,10 +116,8 @@ class CreatePictorial(BaseView):
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 error, _
self.del_cache()
return None, None
def create_pictorial(self, pictorial, platform):
......@@ -151,7 +148,6 @@ class CreatePictorial(BaseView):
pictorial['name'] = pictorial.get('content')[:index_end]
error, pictorial_obj = self.call_rpc('venus/community/crawl/pictorial', data=pictorial, platform=platform)
if error:
self.del_cache()
return error, None
pictorial_id = pictorial_obj.get('id')
......@@ -160,7 +156,6 @@ class CreatePictorial(BaseView):
error, id_ = self.call_rpc('venus/community/crawl/topic', data=obj, platform=platform, pictorial_id=pictorial_id)
if error:
self.del_cache()
return error, None
if pictorial_comments:
if platform == GRAP_PLATFORM.XIAOHONGSHU:
......@@ -171,10 +166,8 @@ class CreatePictorial(BaseView):
error, _ = self.call_rpc('venus/community/crawl/replys', data=pictorial_comments, platform=platform, pictorial_id=pictorial_id)
if error:
self.del_cache()
return error, None
self.del_cache()
return None, None
def post(self, request):
......@@ -204,10 +197,12 @@ class CreatePictorial(BaseView):
for obj in topics:
error, _ = self.create_pictorial(pictorial=obj, platform=platform)
if error:
self.del_cache()
return self.error(error=error)
else:
error, _ = self.create_topic(topics=topics, platform=platform)
if error:
self.del_cache()
return self.error(error=error)
self.del_cache()
......
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