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
1397beca
Commit
1397beca
authored
May 10, 2019
by
haowang
Browse files
Options
Browse Files
Download
Plain Diff
fix dev conflicts
parents
3b0db7fd
a63d42f3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
0 deletions
+80
-0
operation.py
api/operation.py
+69
-0
topic.py
api/topic.py
+4
-0
urls.py
api/urls.py
+3
-0
user.py
api/user.py
+4
-0
No files found.
api/operation.py
View file @
1397beca
...
...
@@ -119,3 +119,72 @@ class PictorialHomeRecommendUpdate(APIView):
return
u'操作失败'
return
data
class
OperationDelete
(
APIView
):
"""删除运营位"""
def
post
(
self
,
request
):
operation_id
=
request
.
POST
.
get
(
'id'
)
try
:
data
=
self
.
rpc
[
'venus/sun/operation/delete'
](
id_
=
operation_id
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'操作失败'
,
e
)
raise
if
not
data
:
return
u'操作失败'
return
data
class
OperationEdit
(
APIView
):
"""编辑运营位"""
def
post
(
self
,
request
):
operation_id
=
request
.
POST
.
get
(
'id'
)
operation_type
=
int
(
request
.
POST
.
get
(
'operation_type'
))
image_url
=
request
.
POST
.
get
(
'image_url'
)
url
=
request
.
POST
.
get
(
'url'
)
start_time
=
int
(
request
.
POST
.
get
(
'start_time'
))
end_time
=
int
(
request
.
POST
.
get
(
'end_time'
))
long_image_url
=
request
.
POST
.
get
(
'long_image_url'
)
is_repeat_read
=
int
(
request
.
POST
.
get
(
'is_repeat_read'
,
1
))
data
=
{
"operation_type"
:
operation_type
,
"image_url"
:
image_url
,
"long_image_url"
:
long_image_url
,
"url"
:
url
,
"start_time"
:
start_time
,
"end_time"
:
end_time
,
"is_repeat_read"
:
is_repeat_read
}
try
:
data
=
self
.
rpc
[
'venus/sun/operation/edit'
](
id_
=
operation_id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'操作失败'
,
e
)
raise
if
not
data
:
return
u'操作失败'
return
data
class
OperationList
(
APIView
):
"""获取运营位列表"""
def
get
(
self
,
request
):
operation_type
=
request
.
GET
.
get
(
'operation_type'
)
try
:
data
=
self
.
rpc
[
'venus/sun/operation/list'
](
operation_type
=
operation_type
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取失败'
,
e
)
raise
return
data
api/topic.py
View file @
1397beca
...
...
@@ -115,11 +115,14 @@ class TopicUpdateOrCreateView(APIView):
return
{
'data'
:
data
}
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
,
''
)
topic_images
=
list
(
map
(
lambda
x
:
x
[:
-
2
],
json
.
loads
(
request
.
POST
.
get
(
'topic_images'
,
'[]'
))))
tag_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
':'
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'tags'
,
'[]'
))))
collection_tag_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
':'
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'collection_tags'
,
'[]'
))))
cut_word_tag_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
':'
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'cut_word_tags'
,
'[]'
))))
body_esthetics_tag_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
':'
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'body_esthetics_tags'
,
'[]'
))))
pictorial_ids
=
list
(
json
.
loads
(
request
.
POST
.
get
(
'pictorial_ids'
,
'[]'
)))
data
=
{
...
...
@@ -141,6 +144,7 @@ class TopicUpdateOrCreateView(APIView):
'virtual_vote_num'
:
request
.
POST
.
get
(
'virtual_vote_num'
,
''
),
'is_home'
:
int
(
request
.
POST
.
get
(
'is_home'
,
0
)),
'is_recommend'
:
int
(
request
.
POST
.
get
(
'is_recommend'
,
0
)),
'body_esthetics_tag_ids'
:
body_esthetics_tag_ids
,
}
try
:
self
.
rpc
[
'venus/sun/topic/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
...
...
api/urls.py
View file @
1397beca
...
...
@@ -143,6 +143,9 @@ urlpatterns = [
url
(
r'^operation/home_fix'
,
TopicHomeFixOperation
.
as_view
()),
url
(
r'^operation/pictorial/recommend/list'
,
PictorialHomeRecommendList
.
as_view
()),
url
(
r'^operation/pictorial/recommend/update'
,
PictorialHomeRecommendUpdate
.
as_view
()),
url
(
r'^operation/edit'
,
OperationEdit
.
as_view
()),
url
(
r'^operation/list'
,
OperationList
.
as_view
()),
url
(
r'^operation/delete'
,
OperationDelete
.
as_view
()),
# 工具
url
(
r'^tools/virtual_vote$'
,
VirtualVote
.
as_view
()),
...
...
api/user.py
View file @
1397beca
...
...
@@ -55,10 +55,13 @@ class UserUpdateOrCreate(APIView):
return
data
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
,
''
)
user_id
=
request
.
POST
.
get
(
'user_id'
,
''
)
tag_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'tags'
,
'[]'
))))
password
=
make_password
(
settings
.
PUPPET_PASSWORD
,
None
,
'pbkdf2_sha256'
)
body_esthetics_tag_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
':'
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'body_esthetics_tags'
,
'[]'
))))
data
=
{
'user_id'
:
user_id
,
...
...
@@ -73,6 +76,7 @@ class UserUpdateOrCreate(APIView):
'email'
:
request
.
POST
.
get
(
'email'
),
'gender'
:
request
.
POST
.
get
(
'gender'
),
'is_tcc'
:
int
(
request
.
POST
.
get
(
'is_tcc'
,
0
)),
'body_esthetics_tag_ids'
:
body_esthetics_tag_ids
,
}
try
:
...
...
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