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
0
Merge Requests
0
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
谢林臻
sun
Commits
d4ccd9e8
Commit
d4ccd9e8
authored
Nov 06, 2019
by
yangchenglin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kol poll
parent
b4f181eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
0 deletions
+74
-0
urls.py
api/urls.py
+4
-0
user.py
api/user.py
+70
-0
No files found.
api/urls.py
View file @
d4ccd9e8
...
...
@@ -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
()),
...
...
api/user.py
View file @
d4ccd9e8
...
...
@@ -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
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