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
84380b68
Commit
84380b68
authored
May 10, 2019
by
haowang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add activity word parent beauty api
parent
e2ff46d6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
209 additions
and
0 deletions
+209
-0
activity.py
api/activity.py
+65
-0
beauty.py
api/beauty.py
+60
-0
urls.py
api/urls.py
+18
-0
word_parent.py
api/word_parent.py
+66
-0
No files found.
api/activity.py
0 → 100644
View file @
84380b68
import
json
from
utils.base
import
APIView
,
get_offset_count
from
utils.logger
import
error_logger
class
ActivityListView
(
APIView
):
def
get
(
self
,
request
):
offset
,
count
=
get_offset_count
(
request
)
name
=
request
.
GET
.
get
(
'name'
,
None
)
is_online
=
request
.
GET
.
get
(
'is_online'
,
None
)
data
=
self
.
rpc
[
'venus/sun/activity/list'
](
offset
=
offset
,
count
=
count
,
name
=
name
,
is_online
=
is_online
)
.
unwrap
()
return
data
class
ActivityCreateView
(
APIView
):
def
post
(
self
,
request
):
name
=
request
.
POST
.
get
(
'name'
,
None
)
un_join_url
=
request
.
POST
.
get
(
'un_join_url'
,
None
)
in_join_url
=
request
.
POST
.
get
(
'in_join_url'
,
None
)
agreement_url
=
request
.
POST
.
get
(
'agreement_url'
,
None
)
if
not
name
:
return
r'缺少参数'
data
=
self
.
rpc
[
'venus/sun/activity/add'
](
name
=
name
,
un_join_url
=
un_join_url
,
in_join_url
=
in_join_url
,
agreement_url
=
agreement_url
)
.
unwrap
()
return
data
class
ActivityUpdateView
(
APIView
):
def
post
(
self
,
request
):
id_
=
request
.
POST
.
get
(
'id'
,
None
)
name
=
request
.
POST
.
get
(
'name'
,
None
)
un_join_url
=
request
.
POST
.
get
(
'un_join_url'
,
None
)
in_join_url
=
request
.
POST
.
get
(
'in_join_url'
,
None
)
agreement_url
=
request
.
POST
.
get
(
'agreement_url'
,
None
)
rank
=
request
.
POST
.
get
(
'rank'
,
None
)
if
not
id_
:
return
r'缺少参数'
data
=
self
.
rpc
[
'venus/sun/activity/edit'
](
id_
=
id_
,
name
=
name
,
un_join_url
=
un_join_url
,
in_join_url
=
in_join_url
,
agreement_url
=
agreement_url
,
rank
=
rank
)
.
unwrap
()
if
not
data
:
return
r'更新失败'
return
data
class
ActivityDeleteView
(
APIView
):
def
post
(
self
,
request
):
id_
=
request
.
POST
.
get
(
'id'
,
None
)
if
not
id_
:
return
r'缺少参数'
data
=
self
.
rpc
[
'venus/sun/activity/delete'
](
id_
=
id_
)
.
unwrap
()
if
not
data
:
return
r'操作失败'
return
data
api/beauty.py
0 → 100644
View file @
84380b68
import
json
from
utils.base
import
APIView
,
get_offset_count
from
utils.logger
import
error_logger
class
BeautyListView
(
APIView
):
def
get
(
self
,
request
):
offset
,
count
=
get_offset_count
(
request
)
parent_word_id
=
request
.
GET
.
get
(
'parent_word_id'
,
None
)
is_online
=
request
.
GET
.
get
(
'is_online'
,
None
)
data
=
self
.
rpc
[
'venus/sun/beauty/list'
](
offset
=
offset
,
count
=
count
,
parent_word_id
=
parent_word_id
,
is_online
=
is_online
)
.
unwrap
()
return
data
class
BeautyCreateView
(
APIView
):
def
post
(
self
,
request
):
url
=
request
.
POST
.
get
(
'url'
,
None
)
parent_word_id
=
request
.
POST
.
get
(
'parent_word_id'
,
None
)
if
not
url
or
not
parent_word_id
:
return
r'缺少参数'
data
=
self
.
rpc
[
'venus/sun/beauty/add'
](
url
=
url
,
parent_word_id
=
parent_word_id
)
.
unwrap
()
return
data
class
BeautyUpdateView
(
APIView
):
def
post
(
self
,
request
):
id_
=
request
.
POST
.
get
(
'id'
,
None
)
url
=
request
.
POST
.
get
(
'url'
,
None
)
parent_word_id
=
request
.
POST
.
get
(
'parent_word_id'
,
None
)
if
not
id_
:
return
r'缺少参数'
data
=
self
.
rpc
[
'venus/sun/beauty/edit'
](
id_
=
id_
,
url
=
url
,
parent_word_id
=
parent_word_id
)
.
unwrap
()
if
not
data
:
return
r'更新失败'
return
data
class
BeautyDeleteView
(
APIView
):
def
post
(
self
,
request
):
id_
=
request
.
POST
.
get
(
'id'
,
None
)
if
not
id_
:
return
r'缺少参数'
data
=
self
.
rpc
[
'venus/sun/beauty/delete'
](
id_
=
id_
)
.
unwrap
()
if
not
data
:
return
r'操作失败'
return
data
api/urls.py
View file @
84380b68
...
...
@@ -149,6 +149,24 @@ urlpatterns = [
url
(
r'^tools/batch_update_topic_tag$'
,
BatchUpdateTopicTag
.
as_view
()),
url
(
r'^tools/batch_create_topic_with_ai_fashion_tag$'
,
BatchCreateTopicWithAiFashionTag
.
as_view
()),
# 母词
url
(
r'^word_parent/list$'
,
VirtualVote
.
as_view
()),
url
(
r'^word_parent/create$'
,
VirtualVote
.
as_view
()),
url
(
r'^word_parent/update$'
,
VirtualVote
.
as_view
()),
url
(
r'^word_parent/delete$'
,
VirtualVote
.
as_view
()),
# 美图
url
(
r'^beauty/list$'
,
VirtualVote
.
as_view
()),
url
(
r'^beauty/create$'
,
VirtualVote
.
as_view
()),
url
(
r'^beauty/update$'
,
VirtualVote
.
as_view
()),
url
(
r'^beauty/delete$'
,
VirtualVote
.
as_view
()),
# 活动
url
(
r'^activity/list$'
,
VirtualVote
.
as_view
()),
url
(
r'^activity/create$'
,
VirtualVote
.
as_view
()),
url
(
r'^activity/update$'
,
VirtualVote
.
as_view
()),
url
(
r'^activity/delete$'
,
VirtualVote
.
as_view
()),
]
search_urlpatterns
=
[
...
...
api/word_parent.py
0 → 100644
View file @
84380b68
import
json
from
utils.base
import
APIView
,
get_offset_count
from
utils.logger
import
error_logger
class
WordParentListView
(
APIView
):
def
get
(
self
,
request
):
offset
,
count
=
get_offset_count
(
request
)
name
=
request
.
GET
.
get
(
'name'
,
None
)
is_online
=
request
.
GET
.
get
(
'is_online'
,
None
)
data
=
self
.
rpc
[
'venus/sun/word_parent/list'
](
offset
=
offset
,
count
=
count
,
name
=
name
,
is_online
=
is_online
)
.
unwrap
()
return
data
class
WordParentCreateView
(
APIView
):
def
post
(
self
,
request
):
name
=
request
.
POST
.
get
(
'name'
,
None
)
children_words
=
json
.
loads
(
request
.
POST
.
get
(
'children_words'
,
'[]'
))
content_ad
=
request
.
POST
.
get
(
'content_ad'
,
None
)
makeup_ad
=
request
.
POST
.
get
(
'makeup_ad'
,
None
)
dress_ad
=
request
.
POST
.
get
(
'dress_ad'
,
None
)
if
not
name
:
return
r'缺少参数'
data
=
self
.
rpc
[
'venus/sun/word_parent/add'
](
name
=
name
,
children_words
=
children_words
,
content_ad
=
content_ad
,
makeup_ad
=
makeup_ad
,
dress_ad
=
dress_ad
)
.
unwrap
()
return
data
class
WordParentUpdateView
(
APIView
):
def
post
(
self
,
request
):
id_
=
request
.
POST
.
get
(
'id'
,
None
)
name
=
request
.
POST
.
get
(
'name'
,
None
)
children_words
=
json
.
loads
(
request
.
POST
.
get
(
'children_words'
,
'[]'
))
content_ad
=
request
.
POST
.
get
(
'content_ad'
,
None
)
makeup_ad
=
request
.
POST
.
get
(
'makeup_ad'
,
None
)
dress_ad
=
request
.
POST
.
get
(
'dress_ad'
,
None
)
if
not
id_
:
return
r'缺少参数'
data
=
self
.
rpc
[
'venus/sun/word_parent/edit'
](
id_
=
id_
,
name
=
name
,
children_words
=
children_words
,
content_ad
=
content_ad
,
makeup_ad
=
makeup_ad
,
dress_ad
=
dress_ad
)
.
unwrap
()
if
not
data
:
return
r'更新失败'
return
data
class
WordParentDeleteView
(
APIView
):
def
post
(
self
,
request
):
id_
=
request
.
POST
.
get
(
'id'
,
None
)
if
not
id_
:
return
r'缺少参数'
data
=
self
.
rpc
[
'venus/sun/word_parent/delete'
](
id_
=
id_
)
.
unwrap
()
if
not
data
:
return
r'操作失败'
return
data
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