Commit 631dff16 authored by yangchenglin's avatar yangchenglin

add black_list

parent bb078aa4
......@@ -74,4 +74,51 @@ class EffectPushTaskView(APIView):
raise
return {
'message': '操作成功'
}
\ No newline at end of file
}
class PushBlackListView(APIView):
def get(self, request):
page = int(request.GET.get('page', 1))
limit = int(request.GET.get('limit', 10))
try:
data = self.rpc['venus/sun/push/black_list'](offset=(page-1) * limit, limit=limit).unwrap()
except Exception as e:
error_logger.error(u'获取push黑名单列表失败%s', e)
raise
return data
class AddBlackListView(APIView):
def post(self, request):
user_id = request.POST.get('user_id').split(':')[0]
try:
self.rpc['venus/sun/push/add_black_list'](user_id=user_id).unwrap()
except Exception as e:
error_logger.error(u'添加失败%s', e)
raise
return {
"message": '添加成功'
}
class RmBlackListView(APIView):
def post(self, request):
user_id = request.POST.get('user_id').split(':')[0]
try:
self.rpc['venus/sun/push/rm_black_list'](user_id=user_id).unwrap()
except Exception as e:
error_logger.error(u'删除失败%s', e)
raise
return {
"message": '添加成功'
}
......@@ -78,6 +78,9 @@ urlpatterns = [
url(r'^push/create', PushUpdateOrCreateView.as_view()),
url(r'^push/detail', PushUpdateOrCreateView.as_view()),
url(r'^push/effect_push', EffectPushTaskView.as_view()),
url(r'^push/black_list', PushBlackListView.as_view()),
url(r'^push/add_black_list', AddBlackListView.as_view()),
url(r'^push/rm_black_list', RmBlackListView.as_view()),
# pick相关
url(r'^pick/list$', PickListView.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