Commit 28df81ef authored by yangchenglin's avatar yangchenglin

最后一题

parent f3ff85be
......@@ -231,3 +231,39 @@ class PictorialFollowsAdd(APIView):
return {
'message': '添加成功'
}
class PictorialTagAdd(APIView):
"""新增榜单tag"""
def post(self, request):
pictorial_ids = json.loads(request.POST.get('pictorial_ids', '[]'))
tag_id = int(request.POST.get('tag_id')) if request.POST.get('tag_id') else None
try:
self.rpc['venus/sun/pictorial/add_tag'](pictorial_ids=pictorial_ids, tag_id=tag_id).unwrap()
except Exception as e:
error_logger.error(u'操作失败%s' % (e))
raise
return {
'message': '添加成功'
}
class PictorialTagRm(APIView):
"""删除榜单tag"""
def post(self, request):
import ipdb
ipdb.set_trace()
pictorial_ids = json.loads(request.POST.get('pictorial_ids', '[]'))
tag_id = int(request.POST.get('tag_id')) if request.POST.get('tag_id') else None
try:
self.rpc['venus/sun/pictorial/rm_tag'](pictorial_ids=pictorial_ids, tag_id=tag_id).unwrap()
except Exception as e:
error_logger.error(u'操作失败%s' % (e))
raise
return {
'message': '添加成功'
}
......@@ -97,10 +97,11 @@ class TagTypeSearchView(APIView):
class PictorialSearchView(APIView):
def get(self, request):
name = request.GET.get('name')
tag_id = request.GET.get('tag_id')
offset, count = get_offset_count(request)
try:
data = self.rpc['venus/sun/pictorial/search'](name=name, offset=offset, count=count).unwrap()
data = self.rpc['venus/sun/pictorial/search'](name=name, tag_id=tag_id, offset=offset, count=count).unwrap()
except Exception as e:
raise e
......
......@@ -165,6 +165,8 @@ urlpatterns = [
url(r'^pictorial/topic/list$', PictorialTopicList.as_view()),
url(r'^pictorial/follows/del$', PictorialFollowsDel.as_view()),
url(r'^pictorial/follows/add$', PictorialFollowsAdd.as_view()),
url(r'^pictorial/tag_add$', PictorialTagAdd.as_view()),
url(r'^pictorial/tag_rm$', PictorialTagRm.as_view()),
#运营位
url(r'^topic/home_recommend/list', TopicHomeRecommendList.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