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
e0d18329
Commit
e0d18329
authored
Aug 06, 2019
by
haowang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://git.wanmeizhensuo.com/alpha/sun
into haow/dev
parents
db396e88
31260d9d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
10 deletions
+35
-10
activity.py
api/activity.py
+1
-1
pictorial.py
api/pictorial.py
+3
-2
search.py
api/search.py
+20
-1
tag.py
api/tag.py
+5
-1
urls.py
api/urls.py
+5
-4
user.py
api/user.py
+1
-1
No files found.
api/activity.py
View file @
e0d18329
...
...
@@ -124,7 +124,7 @@ class PictorialActivityView(APIView):
return
data
class
PictorialActivityOlineView
(
APIView
):
class
PictorialActivityO
n
lineView
(
APIView
):
def
post
(
self
,
request
):
...
...
api/pictorial.py
View file @
e0d18329
...
...
@@ -46,7 +46,7 @@ class PictorialUpdateOrCreate(APIView):
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
)
id
=
int
(
request
.
POST
.
get
(
'id'
))
if
request
.
POST
.
get
(
'id'
)
else
None
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'
,
'[]'
))
...
...
@@ -65,7 +65,8 @@ class PictorialUpdateOrCreate(APIView):
'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
)),
'pictorial_activity_ids'
:
[
int
(
pictorial_activity_id
)
if
pictorial_activity_id
else
None
]
'pictorial_activity_ids'
:
[
int
(
pictorial_activity_id
)]
if
pictorial_activity_id
else
[],
'alias'
:
request
.
POST
.
get
(
'alias'
,
''
),
}
try
:
...
...
api/search.py
View file @
e0d18329
...
...
@@ -97,11 +97,29 @@ class TagTypeSearchView(APIView):
class
PictorialSearchView
(
APIView
):
def
get
(
self
,
request
):
name
=
request
.
GET
.
get
(
'name'
)
offset
,
count
=
get_offset_count
(
request
)
try
:
data
=
self
.
rpc
[
'venus/sun/pictorial/search'
](
name
=
name
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/pictorial/search'
](
name
=
name
,
offset
=
offset
,
count
=
count
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
'data'
:
[
'{id}:{name}'
.
format
(
id
=
search_data
[
'id'
],
name
=
search_data
[
'name'
])
for
search_data
in
data
]
}
class
PictorialActivitySearchView
(
APIView
):
def
get
(
self
,
request
):
name
=
request
.
GET
.
get
(
'name'
)
offset
,
count
=
get_offset_count
(
request
)
try
:
data
=
self
.
rpc
[
'venus/sun/activity/pictorial/search'
](
name
=
name
,
offset
=
offset
,
count
=
count
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
'data'
:
[
'{id}:{name}'
.
format
(
id
=
search_data
[
'id'
],
name
=
search_data
[
'name'
])
for
search_data
in
data
]
}
\ No newline at end of file
api/tag.py
View file @
e0d18329
...
...
@@ -48,10 +48,12 @@ class TagUpdateOrCreateView(APIView):
return
{
'data'
:
data
}
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
)
down_tags
=
list
(
set
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
((
request
.
POST
.
get
(
'down_tags'
,
'[]'
))))))
up_tags
=
list
(
set
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
((
request
.
POST
.
get
(
'up_tags'
,
'[]'
))))))
tagtypes
=
list
(
set
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
((
request
.
POST
.
get
(
'tagtypes'
,
'[]'
))))))
data
=
{
'name'
:
request
.
POST
.
get
(
'name'
)
.
lower
(),
'description'
:
request
.
POST
.
get
(
'description'
,
''
),
...
...
@@ -62,7 +64,9 @@ class TagUpdateOrCreateView(APIView):
'platform'
:
request
.
POST
.
get
(
'platform'
,
1
),
'collection'
:
request
.
POST
.
get
(
'collection'
,
0
),
'alias'
:
request
.
POST
.
get
(
'alias'
,
''
),
'is_show_in_register'
:
request
.
POST
.
get
(
'is_show_in_register'
,
'false'
)
'is_show_in_register'
:
request
.
POST
.
get
(
'is_show_in_register'
,
'false'
),
'pictorial_ids'
:
list
(
(
map
(
lambda
x
:
int
(
x
.
split
(
":"
)[
0
]),
json
.
loads
((
request
.
POST
.
get
(
'pictorial_ids'
,
'[]'
))))))
}
try
:
data
=
self
.
rpc
[
'venus/sun/tag/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
...
...
api/urls.py
View file @
e0d18329
...
...
@@ -191,10 +191,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
'
,
PictorialActivity
View
.
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
$'
,
PictorialActivityOnline
View
.
as_view
()),
# 品牌
url
(
r'^brand/list$'
,
BrandListView
.
as_view
()),
...
...
@@ -232,6 +232,7 @@ search_urlpatterns = [
url
(
r'search/topic$'
,
TopicSearchView
.
as_view
()),
url
(
r'search/tagtype$'
,
TagTypeSearchView
.
as_view
()),
url
(
r'search/pictorial$'
,
PictorialSearchView
.
as_view
()),
url
(
r'search/pictorial_activity$'
,
PictorialActivitySearchView
.
as_view
()),
]
common_urlpatterns
=
[
...
...
api/user.py
View file @
e0d18329
...
...
@@ -69,7 +69,7 @@ class UserUpdateOrCreate(APIView):
data
=
{
'user_id'
:
user_id
,
'password'
:
password
,
'is_recommend'
:
int
(
request
.
POST
.
get
(
'is_recommend'
)),
'is_recommend'
:
int
(
request
.
POST
.
get
(
'is_recommend'
))
if
request
.
POST
.
get
(
'is_recommend'
)
else
0
,
'profile_pic'
:
request
.
POST
.
get
(
'avatar'
)[:
-
2
],
'nick_name'
:
request
.
POST
.
get
(
'nick_name'
),
'tag_ids'
:
tag_ids
,
...
...
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