Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpha
sun
Commits
631dff16
Commit
631dff16
authored
Sep 05, 2019
by
yangchenglin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add black_list
parent
bb078aa4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
2 deletions
+51
-2
push.py
api/push.py
+48
-2
urls.py
api/urls.py
+3
-0
No files found.
api/push.py
View file @
631dff16
...
...
@@ -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"
:
'添加成功'
}
api/urls.py
View file @
631dff16
...
...
@@ -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
()),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment