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
d94da631
Commit
d94da631
authored
Apr 02, 2019
by
王浩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add operation pictorial home recommend api
parent
7ef94b51
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
8 deletions
+13
-8
operation.py
api/operation.py
+9
-5
pictorial.py
api/pictorial.py
+2
-1
urls.py
api/urls.py
+2
-2
No files found.
api/operation.py
View file @
d94da631
import
json
from
utils.base
import
APIView
,
get_offset_count
from
utils.logger
import
error_logger
...
...
@@ -86,7 +87,7 @@ class PictorialHomeRecommendList(APIView):
def
get
(
self
,
request
):
offset
,
count
=
get_offset_count
(
request
)
filters
=
request
.
GET
.
get
(
'filters'
,
'{}'
)
filters
=
json
.
loads
(
request
.
GET
.
get
(
'filters'
,
'{}'
)
)
sort_by
=
request
.
GET
.
get
(
'sort_by'
,
None
)
try
:
...
...
@@ -106,12 +107,15 @@ class PictorialHomeRecommendUpdate(APIView):
rank
=
request
.
POST
.
get
(
'rank'
)
try
:
if
pictorial_id
:
data
=
self
.
rpc
[
'venus/sun/operation/recommend/pictorial/
delete'
](
pictorial_id
=
pictorial_id
)
.
unwrap
()
elif
rank
:
data
=
self
.
rpc
[
'venus/sun/operation/recommend/pictorial/
rank'
](
rank
=
rank
)
.
unwrap
()
if
rank
:
data
=
self
.
rpc
[
'venus/sun/operation/recommend/pictorial/
rank'
](
pictorial_id
=
pictorial_id
,
rank
=
rank
)
.
unwrap
()
elif
pictorial_id
:
data
=
self
.
rpc
[
'venus/sun/operation/recommend/pictorial/
delete'
](
pictorial_id
=
pictorial_id
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'操作失败'
,
e
)
raise
if
not
data
:
return
u'操作失败'
return
data
api/pictorial.py
View file @
d94da631
...
...
@@ -58,7 +58,8 @@ class PictorialUpdateOrCreate(APIView):
'is_recommend'
:
int
(
request
.
POST
.
get
(
'is_recommend'
,
0
)),
'pictorial_user_ids'
:
pictorial_user_ids
,
'icon'
:
request
.
POST
.
get
(
'icon'
,
''
),
'collection_tag_ids'
:
collection_tag_ids
'collection_tag_ids'
:
collection_tag_ids
,
'is_home_recommend'
:
request
.
POST
.
get
(
'is_home_recommend'
,
0
),
}
try
:
data
=
self
.
rpc
[
'venus/sun/pictorial/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
...
...
api/urls.py
View file @
d94da631
...
...
@@ -137,8 +137,8 @@ urlpatterns = [
url
(
r'^topic/home_recommend/list'
,
TopicHomeRecommendList
.
as_view
()),
url
(
r'^topic/home_recommend/edit'
,
TopicHomeRecommendEdit
.
as_view
()),
url
(
r'^operation/home_fix'
,
TopicHomeFixOperation
.
as_view
()),
url
(
r'^
pictorial/home
/recommend/list'
,
PictorialHomeRecommendList
.
as_view
()),
url
(
r'^
pictorial/home
/recommend/update'
,
PictorialHomeRecommendUpdate
.
as_view
()),
url
(
r'^
operation/pictorial
/recommend/list'
,
PictorialHomeRecommendList
.
as_view
()),
url
(
r'^
operation/pictorial
/recommend/update'
,
PictorialHomeRecommendUpdate
.
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