Commit f8d82fbc authored by 王浩's avatar 王浩

Merge branch 'haow/dev' into 'dev'

add pictorial operation api

See merge request !160
parents 75757ca7 7ef94b51
...@@ -79,3 +79,39 @@ class TopicHomeFixOperation(APIView): ...@@ -79,3 +79,39 @@ class TopicHomeFixOperation(APIView):
return { return {
'message': '更新成功' 'message': '更新成功'
} }
class PictorialHomeRecommendList(APIView):
"""获取画报首页运营位推荐画报列表"""
def get(self, request):
offset, count = get_offset_count(request)
filters = request.GET.get('filters', '{}')
sort_by = request.GET.get('sort_by', None)
try:
data = self.rpc['venus/sun/operation/recommend/pictorial/list'](filters=filters, sort_by=sort_by, offset=offset, count=count).unwrap()
except Exception as e:
error_logger.error(u'获取数据失败', e)
raise
return data
class PictorialHomeRecommendUpdate(APIView):
"""更新画报首页运营位推荐画报"""
def post(self, request):
pictorial_id = request.POST.get('id')
rank = request.POST.get('rank')
try:
if pictorial_id:
data = self.rpc['venus/sun/operation/recommend/pictorial/delete'](pictorial_id=pictorial_id).unwrap()
elif rank:
data = self.rpc['venus/sun/operation/recommend/pictorial/rank'](rank=rank).unwrap()
except Exception as e:
error_logger.error(u'操作失败', e)
raise
return data
...@@ -137,6 +137,8 @@ urlpatterns = [ ...@@ -137,6 +137,8 @@ urlpatterns = [
url(r'^topic/home_recommend/list', TopicHomeRecommendList.as_view()), url(r'^topic/home_recommend/list', TopicHomeRecommendList.as_view()),
url(r'^topic/home_recommend/edit', TopicHomeRecommendEdit.as_view()), url(r'^topic/home_recommend/edit', TopicHomeRecommendEdit.as_view()),
url(r'^operation/home_fix', TopicHomeFixOperation.as_view()), url(r'^operation/home_fix', TopicHomeFixOperation.as_view()),
url(r'^pictorial/home/recommend/list', PictorialHomeRecommendList.as_view()),
url(r'^pictorial/home/recommend/update', PictorialHomeRecommendUpdate.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