Commit 8f97e6d9 authored by 许俊鹏's avatar 许俊鹏

Merge branch 'xujunpeng/temporary/alpha1-2' into 'dev'

合并批量修改帖子的方法

See merge request alpha/sun!46
parents e972be54 67e9bb67
......@@ -116,25 +116,11 @@ class ReplyCreate(APIView):
class TopicListBatchUpdate(APIView):
def post(self, request):
ids = json.loads(request.POST.get('ids', '[]'))
updates = json.loads(request.POST.get('updates', '{}'))
extra = json.loads(request.POST.get('extra', '{}'))
try:
self.rpc['venus/sun/topic/batch/update'](updates=updates, ids=ids, extra=extra).unwrap()
except Exception as e:
error_logger.error(u'批量更新帖子失败%s', e)
raise
return {
"message": "更新成功"
}
class TopicListBatchUpdate_new(APIView):
def post(self, request):
ids = request.POST.get('ids', '').split()
updates = self.handle_filter(request.POST.get('updates', "{}"))
extra = json.loads(request.POST.get('extra', '{}'))
try:
self.rpc['venus/sun/topic/batch/update'](updates=updates, ids=ids).unwrap()
except Exception as e:
......@@ -143,4 +129,3 @@ class TopicListBatchUpdate_new(APIView):
return {
"message": "更新成功"
}
......@@ -55,7 +55,6 @@ urlpatterns = [
url(r'^topic/reply/list$', ReplyUpdateOrCreateView.as_view()),
url(r'^topic/reply/batch_delete$', ReplyUpdateOrCreateView.as_view()),
url(r'^topic/reply/create$', ReplyCreate.as_view()),
url(r'^topic/batch_update_new$', TopicListBatchUpdate_new.as_view()), # TODO 后台优化临时需求, 1.2 上线后与topic/batch_update 整合到一起
# star相关
url(r'^celebrity/list$', CelebrityListView.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