Commit 0e0c50c9 authored by haowang's avatar haowang

fix code

parent e0d18329
from datetime import datetime from datetime import datetime
import json
from utils.base import APIView from utils.base import APIView
from utils.logger import error_logger from utils.logger import error_logger
from alpha_types.venus import REPLY_TYPE, REPLY_BELONG_TYPE, USER_EXTRA_TYPE from alpha_types.venus import REPLY_TYPE, REPLY_BELONG_TYPE, USER_EXTRA_TYPE
...@@ -60,7 +61,7 @@ class ReplyListView(APIView): ...@@ -60,7 +61,7 @@ class ReplyListView(APIView):
filters['create_time__lte'] = to_create_time filters['create_time__lte'] = to_create_time
try: try:
data = self.rpc['venus/sun/reply/list'](offset=(page-1) * limit, limit=limit, filters=filters, other_filters=other_filters).unwrap() data = self.rpc['venus/sun/manage/reply/list'](offset=(page-1) * limit, limit=limit, filters=filters, other_filters=other_filters).unwrap()
except Exception as e: except Exception as e:
error_logger.error(u'获取reply列表失败%s', e) error_logger.error(u'获取reply列表失败%s', e)
raise raise
...@@ -86,7 +87,7 @@ class ReplyCreateView(APIView): ...@@ -86,7 +87,7 @@ class ReplyCreateView(APIView):
'type': REPLY_TYPE.PUPPET_REPLY_ANS, 'type': REPLY_TYPE.PUPPET_REPLY_ANS,
} }
try: try:
rep = self.rpc['venus/sun/reply/edit'](id_=id_, data=data, ).unwrap() rep = self.rpc['venus/sun/manage/reply/edit'](id_=id_, data=data).unwrap()
except Exception as e: except Exception as e:
error_logger.error(u'创建/编辑%s-reply信息失败%s' % (id, e)) error_logger.error(u'创建/编辑%s-reply信息失败%s' % (id, e))
raise raise
...@@ -94,3 +95,18 @@ class ReplyCreateView(APIView): ...@@ -94,3 +95,18 @@ class ReplyCreateView(APIView):
"message": '更新成功', "message": '更新成功',
"id": rep['id'] "id": rep['id']
} }
class ReplyBatchUpdate(APIView):
def post(self, request):
ids = json.loads(request.POST.get('ids', '[]'))
is_online = request.POST.get('is_online', None)
try:
rep = self.rpc['venus/sun/reply/manage/batch/update'](ids=ids, is_online=is_online).unwrap()
except Exception as e:
error_logger.error(u'更新-reply信息失败%s' % (e))
raise
return {
"message": '更新成功',
}
...@@ -220,7 +220,7 @@ urlpatterns = [ ...@@ -220,7 +220,7 @@ urlpatterns = [
# 评论管理 # 评论管理
url(r'^reply/list$', ReplyListView.as_view()), url(r'^reply/list$', ReplyListView.as_view()),
url(r'^reply/create$', ReplyCreateView.as_view()), url(r'^reply/create$', ReplyCreateView.as_view()),
url(r'^reply/batch/update$', ReplyBatchUpdate.as_view()),
] ]
search_urlpatterns = [ search_urlpatterns = [
......
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