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
d020bdfc
Commit
d020bdfc
authored
Mar 15, 2019
by
王浩
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'haow/dev' into 'dev'
fix pictorial api See merge request
alpha/sun!103
parents
d744592b
ba5e8f67
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
48 deletions
+6
-48
pictorial.py
api/pictorial.py
+6
-45
urls.py
api/urls.py
+0
-3
No files found.
api/pictorial.py
View file @
d020bdfc
...
...
@@ -7,9 +7,9 @@ class PictorialListView(APIView):
def
get
(
self
,
request
):
star_id
=
request
.
GET
.
get
(
'star_id'
)
user_id
=
request
.
GET
.
get
(
'user_id'
)
offset
=
int
(
request
.
GET
.
get
(
'page'
,
0
))
offset
=
int
(
request
.
GET
.
get
(
'page'
,
1
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
filters
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
""
))
filters
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
'{}'
))
if
star_id
:
filters
.
update
({
'star_id'
:
star_id
})
if
user_id
:
...
...
@@ -46,17 +46,17 @@ class PictorialUpdateOrCreate(APIView):
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
)
star_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'star'
,
'[]'
))
))
pictorial_user_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'pictorial_users'
,
'[]'
))
))
star_ids
=
json
.
loads
(
request
.
POST
.
get
(
'star'
,
'[]'
))
pictorial_user_ids
=
json
.
loads
(
request
.
POST
.
get
(
'pictorial_user_ids'
,
'[]'
))
data
=
{
'name'
:
request
.
POST
.
get
(
'name'
,
''
),
'description'
:
request
.
POST
.
get
(
'description'
,
''
),
'creator_id'
:
request
.
POST
.
get
(
'
user'
,
''
)
.
split
(
':'
)[
0
]
,
'creator_id'
:
request
.
POST
.
get
(
'
creator_id'
,
''
)
,
'celebrity_ids'
:
star_ids
,
'is_online'
:
int
(
request
.
POST
.
get
(
'is_online'
,
0
)),
'is_recommend'
:
int
(
request
.
POST
.
get
(
'is_recommend'
,
0
)),
'pictorial_user_ids'
:
pictorial_user_ids
,
'icon'
:
request
.
POST
.
get
(
'icon'
,
''
)
[:
-
2
]
'icon'
:
request
.
POST
.
get
(
'icon'
,
''
)
}
try
:
self
.
rpc
[
'venus/sun/pictorial/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
...
...
@@ -66,41 +66,3 @@ class PictorialUpdateOrCreate(APIView):
return
{
'message'
:
'更新成功'
}
class
PictorialRelatedUser
(
APIView
):
def
get
(
self
,
request
):
id
=
request
.
GET
.
get
(
'id'
)
offset
=
int
(
request
.
GET
.
get
(
'page'
,
0
))
count
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
filters
=
{
'pictorial_id'
:
id
}
try
:
data
=
self
.
rpc
[
'venus/sun/pictorial/user/list'
](
filters
=
filters
,
offset
=
(
offset
-
1
)
*
count
,
limit
=
count
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取画报用户信息失败
%
s'
,
e
)
raise
return
data
class
PictorialRelatedUserGET
(
APIView
):
def
get
(
self
,
request
):
id
=
request
.
GET
.
get
(
'id'
,
''
)
.
split
(
':'
)[
0
]
try
:
data
=
self
.
rpc
[
'venus/sun/pictorial/user/get'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取画报用户信息失败
%
s'
,
e
)
raise
return
[
data
,
]
def
post
(
self
,
request
):
pictorial_id
=
request
.
POST
.
get
(
'pictorial_id'
)
user_id
=
request
.
POST
.
get
(
'user_id'
)
data
=
{
'role_id'
:
request
.
POST
.
get
(
'original_pictorial_identify'
),
}
try
:
self
.
rpc
[
'venus/sun/pictorial/user/edit'
](
id
=
pictorial_id
,
user_id
=
user_id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'编辑画报用户
%
s信息失败
%
s'
%
(
user_id
,
e
))
raise
return
\ No newline at end of file
api/urls.py
View file @
d020bdfc
...
...
@@ -135,9 +135,6 @@ urlpatterns = [
url
(
r'^pictorial/list/update$'
,
PictorialListView
.
as_view
()),
url
(
r'^pictorial/get$'
,
PictorialUpdateOrCreate
.
as_view
()),
url
(
r'^pictorial/create$'
,
PictorialUpdateOrCreate
.
as_view
()),
url
(
r'^pictorial/user/list$'
,
PictorialRelatedUser
.
as_view
()),
url
(
r'^pictorial/user/get$'
,
PictorialRelatedUserGET
.
as_view
()),
# url(r'^pictorial/user/edit_group_identify', PictorialRelatedUserGET.as_view()),
]
search_urlpatterns
=
[
...
...
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