Commit 78aa261a authored by 杨成林's avatar 杨成林

Merge branch 'ycl/push_blacklist' into 'test'

add black_list

See merge request alpha/sun!347
parents 28b3b78f 631dff16
...@@ -74,4 +74,51 @@ class EffectPushTaskView(APIView): ...@@ -74,4 +74,51 @@ class EffectPushTaskView(APIView):
raise raise
return { return {
'message': '操作成功' '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 = [ ...@@ -78,6 +78,9 @@ urlpatterns = [
url(r'^push/create', PushUpdateOrCreateView.as_view()), url(r'^push/create', PushUpdateOrCreateView.as_view()),
url(r'^push/detail', PushUpdateOrCreateView.as_view()), url(r'^push/detail', PushUpdateOrCreateView.as_view()),
url(r'^push/effect_push', EffectPushTaskView.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相关 # pick相关
url(r'^pick/list$', PickListView.as_view()), 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