Commit d94da631 authored by 王浩's avatar 王浩

add operation pictorial home recommend api

parent 7ef94b51
import json
from utils.base import APIView, get_offset_count
from utils.logger import error_logger
......@@ -86,7 +87,7 @@ class PictorialHomeRecommendList(APIView):
def get(self, request):
offset, count = get_offset_count(request)
filters = request.GET.get('filters', '{}')
filters = json.loads(request.GET.get('filters', '{}'))
sort_by = request.GET.get('sort_by', None)
try:
......@@ -106,12 +107,15 @@ class PictorialHomeRecommendUpdate(APIView):
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()
if rank:
data = self.rpc['venus/sun/operation/recommend/pictorial/rank'](pictorial_id=pictorial_id, rank=rank).unwrap()
elif pictorial_id:
data = self.rpc['venus/sun/operation/recommend/pictorial/delete'](pictorial_id=pictorial_id).unwrap()
except Exception as e:
error_logger.error(u'操作失败', e)
raise
if not data:
return u'操作失败'
return data
......@@ -58,7 +58,8 @@ class PictorialUpdateOrCreate(APIView):
'is_recommend': int(request.POST.get('is_recommend', 0)),
'pictorial_user_ids': pictorial_user_ids,
'icon': request.POST.get('icon', ''),
'collection_tag_ids': collection_tag_ids
'collection_tag_ids': collection_tag_ids,
'is_home_recommend': request.POST.get('is_home_recommend', 0),
}
try:
data = self.rpc['venus/sun/pictorial/edit'](id=id, data=data).unwrap()
......
......@@ -137,8 +137,8 @@ urlpatterns = [
url(r'^topic/home_recommend/list', TopicHomeRecommendList.as_view()),
url(r'^topic/home_recommend/edit', TopicHomeRecommendEdit.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()),
url(r'^operation/pictorial/recommend/list', PictorialHomeRecommendList.as_view()),
url(r'^operation/pictorial/recommend/update', PictorialHomeRecommendUpdate.as_view()),
]
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