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): ...@@ -24,11 +24,12 @@ class ReplyUpdateOrCreateView(APIView):
return data return data
def post(self, request): def post(self, request):
reply_ids = json.loads(request.POST.get('reply_ids', [])) reply_ids = json.loads(request.POST.get('reply_ids', []))
try: try:
self.rpc['venus/sun/reply/batch_delete'](ids=reply_ids).unwrap() self.rpc['venus/sun/reply/batch_delete'](ids=reply_ids).unwrap()
except Exception as e: except Exception as e:
error_logger.error(u'批量更新帖子失败%s', e) error_logger.error(u'批量更新回复失败%s', e)
raise raise
return { return {
'message': '操作成功' 'message': '操作成功'
...@@ -57,6 +58,23 @@ class ReplyCreate(APIView): ...@@ -57,6 +58,23 @@ class ReplyCreate(APIView):
try: try:
data = self.rpc['venus/sun/reply/edit'](id=None, data=data).unwrap() data = self.rpc['venus/sun/reply/edit'](id=None, data=data).unwrap()
except Exception as e: except Exception as e:
error_logger.error(u'编辑帖子失败%s', e) error_logger.error(u'编辑评论失败%s', e)
raise raise
return {'data': data} 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 {
'message': '操作成功'
}
...@@ -218,6 +218,7 @@ urlpatterns = [ ...@@ -218,6 +218,7 @@ urlpatterns = [
url(r'^reply/list$', ReplyUpdateOrCreateView.as_view()), url(r'^reply/list$', ReplyUpdateOrCreateView.as_view()),
url(r'^reply/batch_delete$', ReplyUpdateOrCreateView.as_view()), url(r'^reply/batch_delete$', ReplyUpdateOrCreateView.as_view()),
url(r'^reply/create$', ReplyCreate.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