Commit 1c4922c8 authored by 杨成林's avatar 杨成林

Merge branch 'ycl/fix_dev' into 'dev'

reply vote

See merge request alpha/sun!283
parents 64ff09c5 ef142bd0
......@@ -24,11 +24,12 @@ class ReplyUpdateOrCreateView(APIView):
return data
def post(self, request):
reply_ids = json.loads(request.POST.get('reply_ids', []))
try:
self.rpc['venus/sun/reply/batch_delete'](ids=reply_ids).unwrap()
except Exception as e:
error_logger.error(u'批量更新帖子失败%s', e)
error_logger.error(u'批量更新回复失败%s', e)
raise
return {
'message': '操作成功'
......@@ -56,7 +57,24 @@ class ReplyCreate(APIView):
try:
data = self.rpc['venus/sun/reply/edit'](id=None, data=data).unwrap()
except Exception as e:
error_logger.error(u'编辑评论失败%s', e)
raise
return {'data': data}
class ReplyVote(APIView):
def post(self, request):
reply_id = request.POST.get('reply_id')
vote_num = request.POST.get('vote_num')
try:
self.rpc['venus/sun/reply/vote'](reply_id=reply_id, vote_num=vote_num).unwrap()
except Exception as e:
error_logger.error(u'编辑帖子失败%s', e)
raise
return {'data': data}
\ No newline at end of file
return {
'message': '操作成功'
}
......@@ -218,6 +218,7 @@ urlpatterns = [
url(r'^reply/list$', ReplyUpdateOrCreateView.as_view()),
url(r'^reply/batch_delete$', ReplyUpdateOrCreateView.as_view()),
url(r'^reply/create$', ReplyCreate.as_view()),
url(r'^reply/vote$', ReplyVote.as_view()),
]
......
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