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
3437eb2b
Commit
3437eb2b
authored
Jul 15, 2019
by
杨成林
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ycl/pictorial_activity' into 'test'
Ycl/pictorial activity See merge request
alpha/sun!238
parents
900e796e
dd6ac928
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
3 deletions
+75
-3
activity.py
api/activity.py
+64
-1
operation.py
api/operation.py
+3
-1
pictorial.py
api/pictorial.py
+4
-1
urls.py
api/urls.py
+4
-0
No files found.
api/activity.py
View file @
3437eb2b
import
json
from
datetime
import
datetime
from
utils.base
import
APIView
,
get_offset_count
from
utils.logger
import
error_logger
class
ActivityListView
(
APIView
):
...
...
@@ -74,3 +74,66 @@ class ActivityDeleteView(APIView):
return
r'操作失败'
return
data
class
PictorialActivityListView
(
APIView
):
def
get
(
self
,
request
):
name
=
request
.
GET
.
get
(
'name'
)
page
=
int
(
request
.
GET
.
get
(
'page'
,
1
))
count
=
int
(
request
.
GET
.
get
(
'count'
,
10
))
data
=
self
.
rpc
[
'venus/sun/activity/pictrial/list'
](
name
=
name
,
offset
=
(
page
-
1
)
*
count
,
count
=
count
)
.
unwrap
()
if
not
data
:
return
r'获取失败'
return
data
class
PictorialActivityView
(
APIView
):
def
get
(
self
,
request
):
id_
=
int
(
request
.
GET
.
get
(
'id'
))
data
=
self
.
rpc
[
'venus/sun/activity/pictrial/info'
](
id_
=
id_
)
.
unwrap
()
if
not
data
:
return
r'获取失败'
return
data
.
get
(
"data"
)
def
post
(
self
,
request
):
data
=
{
"id"
:
request
.
POST
.
get
(
'id'
),
"name"
:
request
.
POST
.
get
(
'name'
,
None
),
"start_time"
:
request
.
POST
.
get
(
'start_time'
),
"end_time"
:
request
.
POST
.
get
(
'end_time'
),
"version"
:
request
.
POST
.
get
(
'version'
,
'0.0.0'
),
"banner"
:
request
.
POST
.
get
(
'banner'
),
"description"
:
request
.
POST
.
get
(
'description'
),
"titles"
:
json
.
loads
(
request
.
POST
.
get
(
'titles'
,
'[]'
))
}
data
=
self
.
rpc
[
'venus/sun/activity/pictrial/edit'
](
data
=
data
)
.
unwrap
()
if
not
data
:
return
r'操作失败'
return
data
class
PictorialActivityOlineView
(
APIView
):
def
post
(
self
,
request
):
id_
=
int
(
request
.
POST
.
get
(
'id'
))
is_online
=
int
(
request
.
POST
.
get
(
'is_online'
))
data
=
self
.
rpc
[
'venus/sun/activity/pictrial/online'
](
id_
=
id_
,
is_online
=
is_online
)
.
unwrap
()
if
not
data
:
return
r'操作失败'
return
data
api/operation.py
View file @
3437eb2b
...
...
@@ -67,12 +67,14 @@ class TopicHomeFixOperation(APIView):
image
=
request
.
POST
.
get
(
'image'
)
protocol
=
request
.
POST
.
get
(
"protocol"
)
pos
=
request
.
POST
.
get
(
"pos"
,
4
)
version
=
request
.
POST
.
get
(
"version"
,
4
)
if
not
image
or
not
protocol
:
return
{
'message'
:
'参数不全'
}
try
:
self
.
rpc
[
'venus/sun/operation/home_fix/edit'
](
image
=
image
,
protocol
=
protocol
,
pos
=
pos
)
.
unwrap
()
self
.
rpc
[
'venus/sun/operation/home_fix/edit'
](
image
=
image
,
protocol
=
protocol
,
pos
=
pos
,
version
=
version
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'更新失败'
,
e
)
raise
...
...
api/pictorial.py
View file @
3437eb2b
...
...
@@ -46,10 +46,12 @@ class PictorialUpdateOrCreate(APIView):
return
data
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
)
star_ids
=
json
.
loads
(
request
.
POST
.
get
(
'star'
,
'[]'
))
pictorial_user_ids
=
json
.
loads
(
request
.
POST
.
get
(
'pictorial_user_ids'
,
'[]'
))
collection_tag_ids
=
json
.
loads
(
request
.
POST
.
get
(
'collection_tag_ids'
,
'[]'
))
pictorial_activity_id
=
request
.
POST
.
get
(
'pictorial_activity_id'
)
data
=
{
'name'
:
request
.
POST
.
get
(
'name'
,
''
),
'description'
:
request
.
POST
.
get
(
'description'
,
''
),
...
...
@@ -63,7 +65,8 @@ class PictorialUpdateOrCreate(APIView):
'is_home_recommend'
:
int
(
request
.
POST
.
get
(
'is_home_recommend'
,
0
)),
'add_score'
:
int
(
request
.
POST
.
get
(
'add_score'
,
0
)),
'is_public'
:
True
if
request
.
POST
.
get
(
'is_public'
)
==
"true"
else
False
,
'is_feed'
:
int
(
request
.
POST
.
get
(
'is_feed'
,
0
))
'is_feed'
:
int
(
request
.
POST
.
get
(
'is_feed'
,
0
)),
'pictorial_activity_ids'
:
[
int
(
pictorial_activity_id
)
if
pictorial_activity_id
else
None
]
}
try
:
...
...
api/urls.py
View file @
3437eb2b
...
...
@@ -192,6 +192,10 @@ urlpatterns = [
url
(
r'^activity/create$'
,
ActivityCreateView
.
as_view
()),
url
(
r'^activity/update$'
,
ActivityUpdateView
.
as_view
()),
url
(
r'^activity/delete$'
,
ActivityDeleteView
.
as_view
()),
url
(
r'^activity/pictorial'
,
PictorialActivityView
.
as_view
()),
url
(
r'^activity/pictorial'
,
PictorialActivityView
.
as_view
()),
url
(
r'^activity/pictorial/list'
,
PictorialActivityListView
.
as_view
()),
url
(
r'^activity/pictorial/online'
,
PictorialActivityView
.
as_view
()),
# 品牌
url
(
r'^brand/list$'
,
BrandListView
.
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