Commit 2c96553c authored by 杨成林's avatar 杨成林

Merge branch 'ycl/opt_topic' into 'master'

Ycl/opt topic

See merge request !368
parents 4b0f5061 a88d4f97
......@@ -11,7 +11,7 @@ from alpha_types.venus import USER_EXTRA_TYPE
class TopicListView(APIView):
def get(self, request):
pictorial_id = request.GET.get('pictorial_id', '')
user_id = request.GET.get('user_id', '')
page = int(request.GET.get('page', 1))
......@@ -45,6 +45,9 @@ class TopicListView(APIView):
elif int(user_type) == USER_EXTRA_TYPE.EDIT:
filters["is_edit"] = 1
if filters.get("has_product") is not None:
filters["has_product"] = bool(filters["has_product"])
res = self.rpc['physical/search/business/topic'](
offset=(page-1) * limit,
size=limit,
......@@ -161,7 +164,6 @@ class TopicUpdateOrCreateView(APIView):
'is_recommend': int(request.POST.get('is_recommend', 0)),
'body_esthetics_tag_ids': body_esthetics_tag_ids,
'product_id': request.POST.get('product_id'),
'product_recommend': int(request.POST.get('product_recommend', 0)),
'have_face': int(request.POST.get('have_face', 0)),
'is_finished': int(request.POST.get('is_finished', 1)),
}
......@@ -219,7 +221,7 @@ class TopicBallot(APIView):
return {
"message": "更新成功"
}
class TopicProductAdd(APIView):
"""帖子添加商品关系"""
......@@ -253,3 +255,21 @@ class TopicProductDel(APIView):
return {
'message': '更新成功'
}
class TopicBallotBatch(APIView):
"""帖子批量投票"""
def post(self, request):
ids = json.loads(request.POST.get('ids', '[]'))
ballot_num = int(request.POST.get('ballot_num', 0))
try:
self.rpc['venus/sun/topic/ballot_batch'](ids=ids, ballot_num=ballot_num).unwrap()
except Exception as e:
error_logger.error(u'编辑%s帖子信息失败%s' % (ids, e))
raise
return {
'message': '更新成功'
}
......@@ -66,6 +66,7 @@ urlpatterns = [
url(r'^topic/ballot$', TopicBallot.as_view()),
url(r'^topic/product/add$', TopicProductAdd.as_view()),
url(r'^topic/product/del$', TopicProductDel.as_view()),
url(r'^topic/ballot_batch$', TopicBallotBatch.as_view()),
# 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