Commit d4ccd9e8 authored by yangchenglin's avatar yangchenglin

kol poll

parent b4f181eb
......@@ -55,6 +55,10 @@ urlpatterns = [
url(r'^user/create$', UserUpdateOrCreate.as_view()),
url(r'^user/images/get$', UserImage.as_view()),
url(r'^user/images/create$', UserImage.as_view()),
url(r'^user/kol_pool_list$', KOLPoolList.as_view()),
url(r'^user/kol_pool_rm$', KOLPoolRm.as_view()),
url(r'^user/kol_pool_add$', KOLPoolAdd.as_view()),
url(r'^user/kol_pool_edit$', KOLPoolEdit.as_view()),
# topic相关
url(r'^topic/list$', TopicListView.as_view()),
......
......@@ -178,3 +178,72 @@ class UserImage(APIView):
error_logger.error(u'获取%s用户头像失败%s' % (user_id, e))
raise
return data
class KOLPoolList(APIView):
def get(self, request):
page = int(request.GET.get('page', 1))
limit = int(request.GET.get('limit', 50))
try:
res = self.rpc['venus/sun/user/kol_pool_list'](
offset=(page - 1) * limit,
size=limit,
).unwrap()
except Exception as e:
error_logger.error(u'获取kol池失败%s' % e)
raise
return res
class KOLPoolRm(APIView):
def post(self, request):
user_ids = json.loads(request.GET.get('user_ids', "[]"))
try:
res = self.rpc['venus/sun/user/kol_pool_rm'](
user_ids=user_ids
).unwrap()
except Exception as e:
error_logger.error(u'kol池删除用户失败%s' % e)
raise
return res
class KOLPoolAdd(APIView):
def post(self, request):
user_ids = json.loads(request.GET.get('user_ids', "[]"))
try:
self.rpc['venus/sun/user/kol_pool_add'](
user_ids=user_ids
).unwrap()
except Exception as e:
error_logger.error(u'kol池增加用户失败%s' % e)
raise
class KOLPoolEdit(APIView):
def post(self, request):
data = json.loads(request.GET.get('data', "{}"))
try:
self.rpc['venus/sun/user/kol_pool_edit'](
user_ids=data
).unwrap()
except Exception as e:
error_logger.error(u'kol池编辑用户失败%s' % e)
raise
\ No newline at end of file
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