Commit 8ff1f7b7 authored by 王浩's avatar 王浩

Merge branch 'haow/dev' into 'master'

crawl reply insert

See merge request alpha/sun!308
parents 6277338f f72e50ff
......@@ -64,6 +64,7 @@ class PictorialUpdateOrCreate(APIView):
'is_home_recommend': int(request.POST.get('is_home_recommend', 0)),
'add_score': int(request.POST.get('add_score', 0)),
'is_public': True if request.POST.get('is_public') == "true" else False,
'is_finished': int(request.POST.get('is_finished', 1)),
'is_feed': int(request.POST.get('is_feed', 0)),
'pictorial_activity_ids': [int(pictorial_activity_id)] if pictorial_activity_id else [],
'alias': request.POST.get('alias', ''),
......@@ -147,3 +148,52 @@ class PictorialFeedDelete(APIView):
return {
'message': '删除成功'
}
class PictorialTopicList(APIView):
"""获取榜单帖子列表"""
def get(self, request):
id_ = request.GET.get('id')
offset = int(request.GET.get('page', 1))
limit = int(request.GET.get('count', 10))
try:
data = self.rpc['venus/sun/pictorial/topic/list'](id_=id_, offset=(offset-1)*limit, limit=limit).unwrap()
except Exception as e:
error_logger.error(u'获取信息失败%s' % (e))
raise
return data
class PictorialTopicSetRank(APIView):
"""设置榜单中帖子的优先级"""
def post(self, request):
pictorial_id = request.POST.get('pictorial_id')
topic_id = request.POST.get('topic_id')
rank = request.POST.get('rank')
try:
self.rpc['venus/sun/pictorial/topic/set_rank'](pictorial_id=pictorial_id, topic_id=topic_id, rank=rank).unwrap()
except Exception as e:
error_logger.error(u'操作失败%s' % (e))
raise
return {
'message': '操作成功'
}
class PictorialTopicDel(APIView):
"""删除榜单中的帖子"""
def post(self, request):
pictorial_id = request.POST.get('pictorial_id')
topic_id = request.POST.get('topic_id')
try:
self.rpc['venus/sun/pictorial/topic/del'](pictorial_id=pictorial_id, topic_id=topic_id).unwrap()
except Exception as e:
error_logger.error(u'操作失败%s' % (e))
raise
return {
'message': '删除成功'
}
......@@ -86,7 +86,7 @@ class ReplyManageListView(APIView):
def get(self, request):
page = int(request.GET.get('page', 1))
limit = int(request.GET.get('limit', 10))
id_ = request.GET.get('id', None)
topic_id = request.GET.get('topic_id', None)
content = request.GET.get('content', None)
topic_content = request.GET.get('topic_content', None)
user_name = request.GET.get('user_name', None)
......@@ -117,8 +117,8 @@ class ReplyManageListView(APIView):
if user_name:
other_filters['user_name'] = user_name
filters = {}
if id_:
filters['id'] = int(id_)
if topic_id:
filters['topic_id'] = int(topic_id)
if content:
filters['content__contains'] = content
if belong_type:
......@@ -187,3 +187,36 @@ class ReplyManageBatchUpdate(APIView):
return {
"message": '更新成功',
}
class ReplyManageBatchMove(APIView):
def post(self, request):
ids = json.loads(request.POST.get('ids', '[]'))
topic_id = request.POST.get('topic_id', None)
pictorial_id = request.POST.get('pictorial_id', None)
try:
self.rpc['venus/sun/reply/manage/batch/move'](ids=ids, topic_id=topic_id, pictorial_id=pictorial_id).unwrap()
except Exception as e:
error_logger.error(u'平移reply失败%s' % (e))
raise
return {
"message": '更新成功',
}
class ReplyManageEdit(APIView):
def post(self, request):
id_ = request.POST.get('id')
content = request.POST.get('content')
try:
self.rpc['venus/sun/reply/manage/edit'](id_=id_, data={'content': content}).unwrap()
except Exception as e:
error_logger.error(u'平移reply失败%s' % (e))
raise
return {
"message": '更新成功',
}
......@@ -141,6 +141,8 @@ urlpatterns = [
url(r'^suggestion/list$', SuggestionListView.as_view()),
# 画报相关
url(r'^pictorial/topic/set_rank$', PictorialTopicSetRank.as_view()),
url(r'^pictorial/topic/del$', PictorialTopicDel.as_view()),
url(r'^pictorial/list$', PictorialListView.as_view()),
url(r'^pictorial/list/update$', PictorialListView.as_view()),
url(r'^pictorial/get$', PictorialUpdateOrCreate.as_view()),
......@@ -150,6 +152,7 @@ urlpatterns = [
url(r'^pictorial/feed/list$', PictorialFeedlListView.as_view()),
url(r'^pictorial/feed/rank$', PictorialFeedlRank.as_view()),
url(r'^pictorial/feed/delete$', PictorialFeedDelete.as_view()),
url(r'^pictorial/topic/list$', PictorialTopicList.as_view()),
#运营位
url(r'^topic/home_recommend/list', TopicHomeRecommendList.as_view()),
......@@ -221,6 +224,8 @@ urlpatterns = [
url(r'^reply/vote$', ReplyVote.as_view()),
# 评论管理
url(r'^reply/manage/edit$', ReplyManageEdit.as_view()),
url(r'^reply/manage/batch/move$', ReplyManageBatchMove.as_view()),
url(r'^reply/manage/list$', ReplyManageListView.as_view()),
url(r'^reply/manage/create$', ReplyManageCreateView.as_view()),
url(r'^reply/manage/batch/update$', ReplyManageBatchUpdate.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