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
62d18d1c
Commit
62d18d1c
authored
Mar 25, 2019
by
张永
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.wanmeizhensuo.com:alpha/sun
parents
f98d6699
61874a39
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
199 additions
and
116 deletions
+199
-116
pick.py
api/pick.py
+2
-2
pictorial.py
api/pictorial.py
+33
-53
push.py
api/push.py
+3
-3
search.py
api/search.py
+15
-14
star.py
api/star.py
+5
-5
tag.py
api/tag.py
+23
-1
topic.py
api/topic.py
+92
-15
urls.py
api/urls.py
+16
-14
user.py
api/user.py
+10
-9
No files found.
api/pick.py
View file @
62d18d1c
...
...
@@ -46,7 +46,7 @@ class UpdateOrCreateView(APIView):
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
,
''
)
pick_
group_ids
=
list
(
set
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'pick_group
'
,
'[]'
)))))
pick_
pictorial_ids
=
list
(
set
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'pick_pictorial
'
,
'[]'
)))))
country_ids
=
list
(
set
(
map
(
lambda
x
:
x
.
split
(
':'
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'country'
,
'[]'
)))))
position
=
request
.
POST
.
get
(
'position'
)
gender
=
request
.
POST
.
get
(
'gender'
)
...
...
@@ -79,7 +79,7 @@ class UpdateOrCreateView(APIView):
'gender'
:
data_dict
[
'gender'
]
if
id
else
gender
,
'country_ids'
:
country_ids
,
'pick_type'
:
data_dict
[
'pick_type'
]
if
id
else
pick_type
,
'pick_
group'
:
pick_group
_ids
,
'pick_
pictorial'
:
pick_pictorial
_ids
,
'is_online'
:
int
(
request
.
POST
.
get
(
'is_online'
)),
}
if
position
:
...
...
api/
group
.py
→
api/
pictorial
.py
View file @
62d18d1c
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "chenwei"
# Date: 2018/11/15
import
json
from
utils.base
import
APIView
from
utils.logger
import
error_logger
class
Group
ListView
(
APIView
):
class
Pictorial
ListView
(
APIView
):
def
get
(
self
,
request
):
star_id
=
request
.
GET
.
get
(
'star_id'
)
user_id
=
request
.
GET
.
get
(
'user_id'
)
offset
=
int
(
request
.
GET
.
get
(
'page'
,
0
))
offset
=
int
(
request
.
GET
.
get
(
'page'
,
1
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
filters
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
""
))
filters
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
'{}'
))
if
star_id
:
filters
.
update
({
'star_id'
:
star_id
})
if
user_id
:
filters
.
update
({
'user_id'
:
user_id
})
try
:
data
=
self
.
rpc
[
'venus/sun/
group
/list'
](
filters
=
filters
,
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/
pictorial
/list'
](
filters
=
filters
,
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取
小组
列表失败
%
s'
,
e
)
error_logger
.
error
(
u'获取
画报
列表失败
%
s'
,
e
)
raise
return
data
...
...
@@ -30,7 +25,7 @@ class GroupListView(APIView):
ids
=
json
.
loads
(
request
.
POST
.
get
(
'ids'
,
'[]'
))
updates
=
json
.
loads
(
request
.
POST
.
get
(
'updates'
,
'{}'
))
try
:
self
.
rpc
[
'venus/sun/
group
/batch/update'
](
updates
=
updates
,
ids
=
ids
)
.
unwrap
()
self
.
rpc
[
'venus/sun/
pictorial
/batch/update'
](
updates
=
updates
,
ids
=
ids
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'批量更新失败
%
s'
,
e
)
raise
...
...
@@ -39,73 +34,59 @@ class GroupListView(APIView):
}
class
Group
UpdateOrCreate
(
APIView
):
class
Pictorial
UpdateOrCreate
(
APIView
):
def
get
(
self
,
request
):
id
=
request
.
GET
.
get
(
'id'
)
.
split
(
':'
)[
0
]
try
:
data
=
self
.
rpc
[
'venus/sun/
group
/get'
](
id
=
id
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/
pictorial
/get'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取
%
s
用户
信息失败
%
s'
%
(
id
,
e
))
error_logger
.
error
(
u'获取
%
s
画报
信息失败
%
s'
%
(
id
,
e
))
raise
return
data
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
)
star_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'star'
,
'[]'
))))
group_user_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'group_users'
,
'[]'
))))
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'
,
'[]'
))
data
=
{
'name'
:
request
.
POST
.
get
(
'name'
,
''
),
'description'
:
request
.
POST
.
get
(
'description'
,
''
),
'creator_id'
:
request
.
POST
.
get
(
'
user'
,
''
)
.
split
(
':'
)[
0
]
,
'creator_id'
:
request
.
POST
.
get
(
'
creator_id'
,
''
)
,
'celebrity_ids'
:
star_ids
,
'is_online'
:
int
(
request
.
POST
.
get
(
'is_online'
,
0
)),
'is_online'
:
int
(
request
.
POST
.
get
(
'is_online'
,
1
)),
'is_recommend'
:
int
(
request
.
POST
.
get
(
'is_recommend'
,
0
)),
'group_user_ids'
:
group_user_ids
,
'icon'
:
request
.
POST
.
get
(
'icon'
,
''
)[:
-
2
]
'pictorial_user_ids'
:
pictorial_user_ids
,
'icon'
:
request
.
POST
.
get
(
'icon'
,
''
),
'collection_tag_ids'
:
collection_tag_ids
}
try
:
self
.
rpc
[
'venus/sun/group
/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/pictorial
/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'编辑
%
s用户信息失败
%
s'
%
(
id
,
e
))
raise
if
not
data
.
get
(
'id'
):
return
{
'message'
:
'更新成功'
'message'
:
'画报已存在'
}
return
{
'message'
:
'更新成功'
,
'data'
:
data
}
class
GroupRelatedUser
(
APIView
):
def
get
(
self
,
request
):
id
=
request
.
GET
.
get
(
'id'
)
offset
=
int
(
request
.
GET
.
get
(
'page'
,
0
))
count
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
filters
=
{
'group_id'
:
id
}
try
:
data
=
self
.
rpc
[
'venus/sun/group/user/list'
](
filters
=
filters
,
offset
=
(
offset
-
1
)
*
count
,
limit
=
count
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取小组用户信息失败
%
s'
,
e
)
raise
return
data
class
PictorialTopics
(
APIView
):
"""多个帖子关系"""
def
post
(
self
,
request
):
topic_ids
=
json
.
loads
(
request
.
POST
.
get
(
'topic_ids'
,
'[]'
))
pictorial_id
=
request
.
POST
.
get
(
'pictorial_id'
)
class
GroupRelatedUserGET
(
APIView
):
def
get
(
self
,
request
):
id
=
request
.
GET
.
get
(
'id'
,
''
)
.
split
(
':'
)[
0
]
try
:
data
=
self
.
rpc
[
'venus/sun/group/user/get'
](
id
=
id
)
.
unwrap
()
self
.
rpc
[
'venus/sun/pictorial/add_topics'
](
topic_ids
=
topic_ids
,
pictorial_id
=
pictorial_
id
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'
获取小组用户信息失败
%
s'
,
e
)
error_logger
.
error
(
u'
编辑
%
s用户信息失败
%
s'
%
(
id
,
e
)
)
raise
return
[
data
,
]
def
post
(
self
,
request
):
group_id
=
request
.
POST
.
get
(
'group_id'
)
user_id
=
request
.
POST
.
get
(
'user_id'
)
data
=
{
'role_id'
:
request
.
POST
.
get
(
'original_group_identify'
),
return
{
'message'
:
'更新成功'
}
try
:
self
.
rpc
[
'venus/sun/group/user/edit'
](
id
=
group_id
,
user_id
=
user_id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'编辑小组用户
%
s信息失败
%
s'
%
(
user_id
,
e
))
raise
return
\ No newline at end of file
api/push.py
View file @
62d18d1c
...
...
@@ -33,7 +33,7 @@ class PushUpdateOrCreateView(APIView):
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
,
''
)
creator_id
=
request
.
POST
.
get
(
'creator_id'
)
group_topic_id
=
request
.
POST
.
get
(
'group
_topic_id'
,
''
)
pictorial_topic_id
=
request
.
POST
.
get
(
'pictorial
_topic_id'
,
''
)
icon
=
request
.
POST
.
get
(
'icon'
,
''
)
if
icon
.
endswith
(
'-w'
):
icon
=
request
.
POST
.
get
(
'icon'
,
''
)[:
-
2
]
...
...
@@ -42,8 +42,8 @@ class PushUpdateOrCreateView(APIView):
if
url
==
'推送帖子'
:
url
=
'alpha://topic_detail?topic_id='
elif
url
==
'推送小组'
:
url
=
'alpha://
group_detail?group
_id='
full_url
=
url
+
group
_topic_id
url
=
'alpha://
pictorial_detail?pictorial
_id='
full_url
=
url
+
pictorial
_topic_id
data
=
{
'url'
:
full_url
,
...
...
api/search.py
View file @
62d18d1c
...
...
@@ -6,19 +6,6 @@
from
utils.base
import
APIView
,
get_offset_count
class
GroupSearchView
(
APIView
):
def
get
(
self
,
request
):
name
=
request
.
GET
.
get
(
'name'
)
try
:
data
=
self
.
rpc
[
'venus/sun/group/search'
](
name
=
name
)
.
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
CountrySearchView
(
APIView
):
def
get
(
self
,
request
):
name
=
request
.
GET
.
get
(
'name'
)
...
...
@@ -34,8 +21,9 @@ class CountrySearchView(APIView):
class
UserSearchView
(
APIView
):
def
get
(
self
,
request
):
name
=
request
.
GET
.
get
(
'name'
)
offset
,
count
=
get_offset_count
(
request
)
try
:
data
=
self
.
rpc
[
'venus/sun/user/search'
](
name
=
name
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/user/search'
](
name
=
name
,
offset
=
offset
,
count
=
count
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
...
...
@@ -104,3 +92,16 @@ class TagTypeSearchView(APIView):
return
{
'data'
:
[
'{id}:{name}'
.
format
(
id
=
search_data
[
'id'
],
name
=
search_data
[
'name'
])
for
search_data
in
data
]
}
class
PictorialSearchView
(
APIView
):
def
get
(
self
,
request
):
name
=
request
.
GET
.
get
(
'name'
)
try
:
data
=
self
.
rpc
[
'venus/sun/pictorial/search'
](
name
=
name
)
.
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
]
}
api/star.py
View file @
62d18d1c
...
...
@@ -47,7 +47,7 @@ class CelebrityUpdateOrCreate(APIView):
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
,
''
)
gender
=
request
.
POST
.
get
(
'gender'
)
group_ids
=
list
(
set
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'group
s'
,
'[]'
)))))
pictorial_ids
=
list
(
set
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'pictorial
s'
,
'[]'
)))))
updates
=
{
'gender'
:
''
}
...
...
@@ -66,7 +66,7 @@ class CelebrityUpdateOrCreate(APIView):
'is_online'
:
int
(
request
.
POST
.
get
(
'is_online'
)),
'desc'
:
request
.
POST
.
get
(
'description'
),
'portrait'
:
request
.
POST
.
get
(
'avatar'
)[:
-
2
],
'
group_ids'
:
group
_ids
,
'
pictorial_ids'
:
pictorial
_ids
,
}
try
:
self
.
rpc
[
'venus/sun/celebrity/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
...
...
@@ -79,15 +79,15 @@ class CelebrityUpdateOrCreate(APIView):
}
class
CelebrityRelated
Group
(
APIView
):
class
CelebrityRelated
Pictorial
(
APIView
):
def
get
(
self
,
request
):
id
=
request
.
GET
.
get
(
'id'
)
offset
=
int
(
request
.
GET
.
get
(
'page'
,
0
))
count
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
filters
=
{
'star_id'
:
id
,
'is_online'
:
True
}
try
:
data
=
self
.
rpc
[
'venus/sun/
group
/list'
](
filters
=
filters
,
offset
=
(
offset
-
1
)
*
count
,
limit
=
count
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/
pictorial
/list'
](
filters
=
filters
,
offset
=
(
offset
-
1
)
*
count
,
limit
=
count
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取
%
d明星
小组
信息失败
%
s'
%
(
id
,
e
))
error_logger
.
error
(
u'获取
%
d明星
画报
信息失败
%
s'
%
(
id
,
e
))
raise
return
data
api/tag.py
View file @
62d18d1c
...
...
@@ -61,7 +61,8 @@ class TagUpdateOrCreateView(APIView):
'icon_url'
:
request
.
POST
.
get
(
'icon_url'
,
''
)[:
-
2
],
'platform'
:
request
.
POST
.
get
(
'platform'
),
'collection'
:
request
.
POST
.
get
(
'collection'
),
'alias'
:
request
.
POST
.
get
(
'alias'
)
'alias'
:
request
.
POST
.
get
(
'alias'
),
'is_show_in_register'
:
request
.
POST
.
get
(
'is_show_in_register'
)
}
try
:
data
=
self
.
rpc
[
'venus/sun/tag/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
...
...
@@ -122,3 +123,24 @@ class TagTypeUpdateOrCreateView(APIView):
error_logger
.
error
(
u'创建/编辑标签类型
%
d信息失败
%
s'
%
(
id
,
e
))
raise
return
data
class
TagRegisterUpdateView
(
APIView
):
def
get
(
self
,
request
):
data
=
{}
try
:
data
=
self
.
rpc
[
'venus/sun/tag/register_tag/get'
]()
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'拉取信息失败'
)
raise
return
data
def
post
(
self
,
request
):
ids
=
request
.
POST
.
get
(
'tag_ids'
)
try
:
self
.
rpc
[
'venus/sun/tag/register_tag/update'
](
ids
=
ids
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'配置失败'
)
raise
return
{
'msg'
:
'更改成功'
}
api/topic.py
View file @
62d18d1c
...
...
@@ -4,33 +4,96 @@
# Date: 2018/11/15
import
json
from
utils.base
import
APIView
from
utils.base
import
APIView
,
get_offset_count
from
utils.logger
import
error_logger
class
TopicListView
(
APIView
):
def
get
(
self
,
request
):
pictorial_id
=
request
.
GET
.
get
(
'pictorial_id'
,
''
)
user_id
=
request
.
GET
.
get
(
'user_id'
,
''
)
group_id
=
request
.
GET
.
get
(
'group_id'
,
''
)
offset
=
int
(
request
.
GET
.
get
(
'page'
,
0
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
filter
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
""
))
sort_params
=
request
.
GET
.
getlist
(
'sort[]'
)
page
=
int
(
request
.
GET
.
get
(
'page'
,
1
))
limit
=
int
(
request
.
GET
.
get
(
'size'
,
10
))
filters
=
json
.
loads
(
request
.
GET
.
get
(
'filter'
,
"{}"
))
sorts_by
=
list
(
map
(
lambda
i
:
int
(
i
),
request
.
GET
.
getlist
(
'sort_params[]'
,
[
3
])))
if
user_id
:
filter
.
update
({
'user_id'
:
user_id
})
if
group_id
:
filter
.
update
({
'group_id'
:
group_id
})
filters
.
update
({
'user_id'
:
user_id
})
if
pictorial_id
:
filters
.
update
({
"pictorial_id"
:
int
(
pictorial_id
)})
res
=
self
.
rpc
[
'physical/search/business/topic'
](
offset
=
(
page
-
1
)
*
limit
,
size
=
limit
,
filters
=
filters
,
sorts_by
=
sorts_by
)
.
unwrap
()
topic_ids
=
res
.
get
(
"topic_ids"
,
[])
total_count
=
res
.
get
(
"total_count"
,
0
)
try
:
data
=
self
.
rpc
[
'venus/sun/topic/list'
](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
,
sort_params
=
sort_params
topic_ids
=
topic_ids
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取帖子列表失败
%
s'
,
e
)
raise
return
data
result
=
{
"data"
:
data
.
get
(
"data"
,
[]),
"total"
:
total_count
,
}
return
result
class
TopicImageListView
(
APIView
):
def
get
(
self
,
request
):
pictorial_id
=
request
.
GET
.
get
(
'pictorial_id'
,
''
)
page
=
int
(
request
.
GET
.
get
(
'page'
,
1
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
50
))
filters
=
json
.
loads
(
request
.
GET
.
get
(
'filter'
,
"{}"
))
sorts_by
=
list
(
map
(
lambda
i
:
int
(
i
),
request
.
GET
.
getlist
(
'sort_params[]'
,
[
3
])))
filters
.
update
({
"has_image"
:
True
})
if
pictorial_id
:
filters
.
update
({
"pictorial_id"
:
int
(
pictorial_id
)})
res
=
self
.
rpc
[
'physical/search/business/topic'
](
offset
=
(
page
-
1
)
*
limit
,
size
=
limit
,
filters
=
filters
,
sorts_by
=
sorts_by
)
.
unwrap
()
topic_ids
=
res
.
get
(
"topic_ids"
,
[])
total_count
=
res
.
get
(
"total_count"
,
0
)
try
:
data
=
self
.
rpc
[
'venus/community/topic/images_info_dict'
](
topic_ids
=
topic_ids
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取帖子列表失败
%
s'
,
e
)
raise
result
=
[]
for
topic_id
in
topic_ids
:
imgs_info
=
data
.
get
(
str
(
topic_id
),
[])
if
not
imgs_info
:
continue
result
.
append
({
"id"
:
topic_id
,
"img_url"
:
imgs_info
[
0
]
.
get
(
"url"
,
""
)
+
'-w'
})
result
=
{
"data"
:
result
,
"total"
:
total_count
,
}
return
result
class
TopicUpdateOrCreateView
(
APIView
):
...
...
@@ -49,6 +112,7 @@ class TopicUpdateOrCreateView(APIView):
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'
,
'[]'
))))
pictorial_ids
=
list
(
json
.
loads
(
request
.
POST
.
get
(
'pictorial_ids'
,
'[]'
)))
data
=
{
'topic_images'
:
topic_images
,
...
...
@@ -56,7 +120,7 @@ class TopicUpdateOrCreateView(APIView):
'posting_time'
:
request
.
POST
.
get
(
'posting_time'
),
'content'
:
request
.
POST
.
get
(
'content'
,
''
),
'content_level'
:
request
.
POST
.
get
(
'content_level'
,
''
),
'
group_id'
:
request
.
POST
.
get
(
'group'
,
''
)
.
split
(
':'
)[
0
]
,
'
pictorial_ids'
:
pictorial_ids
,
'user_id'
:
request
.
POST
.
get
(
'user'
,
''
)
.
split
(
':'
)[
0
],
'star_id'
:
request
.
POST
.
get
(
'star'
,
''
)
.
split
(
':'
)[
0
],
'tag_ids'
:
tag_ids
,
...
...
@@ -134,3 +198,16 @@ class TopicListBatchUpdate(APIView):
return
{
"message"
:
"更新成功"
}
class
TopicRelatePictorialInfo
(
APIView
):
def
get
(
self
,
request
):
id_
=
request
.
GET
.
get
(
'id'
)
offset
,
count
=
get_offset_count
(
request
)
try
:
data
=
self
.
rpc
[
'venus/sun/topic/relate_pictorial_info'
](
id_
=
id_
,
offset
=
offset
,
count
=
count
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取帖子画报列表失败
%
s'
,
e
)
raise
return
{
'data'
:
data
}
api/urls.py
View file @
62d18d1c
...
...
@@ -8,7 +8,6 @@ from django.conf.urls import url
from
.pick
import
*
from
.push
import
*
from
.group
import
*
from
.user
import
*
from
.topic
import
*
from
.star
import
*
...
...
@@ -21,6 +20,7 @@ from .face_star import *
from
.advertise
import
*
from
.channel_build
import
*
from
.commons
import
*
from
.pictorial
import
*
urlpatterns
=
[
# 登陆,注销相关
...
...
@@ -33,39 +33,32 @@ urlpatterns = [
url
(
r'^account/list/update$'
,
AccountList
.
as_view
()),
url
(
r'^account/detail$'
,
AccountUpdateOrCreateView
.
as_view
()),
url
(
r'^account/create$'
,
AccountUpdateOrCreateView
.
as_view
()),
# user相关
url
(
r'^user/list$'
,
UserListView
.
as_view
()),
url
(
r'^user/list/update$'
,
UserListView
.
as_view
()),
url
(
r'^user/get$'
,
UserUpdateOrCreate
.
as_view
()),
url
(
r'^user/create$'
,
UserUpdateOrCreate
.
as_view
()),
url
(
r'^user/group/list$'
,
UserGroupView
.
as_view
()),
url
(
r'^user/images/get$'
,
UserImage
.
as_view
()),
url
(
r'^user/images/create$'
,
UserImage
.
as_view
()),
# group相关
url
(
r'^group/list$'
,
GroupListView
.
as_view
()),
url
(
r'^group/list/update$'
,
GroupListView
.
as_view
()),
url
(
r'^group/get$'
,
GroupUpdateOrCreate
.
as_view
()),
url
(
r'^group/create$'
,
GroupUpdateOrCreate
.
as_view
()),
url
(
r'^group/user/list$'
,
GroupRelatedUser
.
as_view
()),
url
(
r'^group/user/get$'
,
GroupRelatedUserGET
.
as_view
()),
url
(
r'^group/user/edit_group_identify'
,
GroupRelatedUserGET
.
as_view
()),
# topic相关
url
(
r'^topic/list$'
,
TopicListView
.
as_view
()),
url
(
r'^topic/img/list$'
,
TopicImageListView
.
as_view
()),
url
(
r'^topic/detail$'
,
TopicUpdateOrCreateView
.
as_view
()),
url
(
r'^topic/create$'
,
TopicUpdateOrCreateView
.
as_view
()),
url
(
r'^topic/batch_update$'
,
TopicListBatchUpdate
.
as_view
()),
url
(
r'^topic/reply/list$'
,
ReplyUpdateOrCreateView
.
as_view
()),
url
(
r'^topic/reply/batch_delete$'
,
ReplyUpdateOrCreateView
.
as_view
()),
url
(
r'^topic/reply/create$'
,
ReplyCreate
.
as_view
()),
url
(
r'^topic/related_pictorial_info$'
,
TopicRelatePictorialInfo
.
as_view
()),
# star相关
url
(
r'^celebrity/list$'
,
CelebrityListView
.
as_view
()),
url
(
r'^celebrity/list/update$'
,
CelebrityListView
.
as_view
()),
url
(
r'^celebrity/create$'
,
CelebrityUpdateOrCreate
.
as_view
()),
url
(
r'^celebrity/detail$'
,
CelebrityUpdateOrCreate
.
as_view
()),
url
(
r'^celebrity/celebrity_related_
group_info'
,
CelebrityRelatedGroup
.
as_view
()),
url
(
r'^celebrity/celebrity_related_
pictorial_info'
,
CelebrityRelatedPictorial
.
as_view
()),
# push相关
url
(
r'^push/list$'
,
PushListView
.
as_view
()),
...
...
@@ -91,6 +84,7 @@ urlpatterns = [
url
(
r'^tag/list/update$'
,
TagListView
.
as_view
()),
url
(
r'^tag/create$'
,
TagUpdateOrCreateView
.
as_view
()),
url
(
r'^tag/detail$'
,
TagUpdateOrCreateView
.
as_view
()),
url
(
r'^tag/register_show/update$'
,
TagRegisterUpdateView
.
as_view
()),
# 标签类型相关
url
(
r'^tag/tagtype/list$'
,
TagTypeListView
.
as_view
()),
...
...
@@ -127,11 +121,18 @@ urlpatterns = [
url
(
r'^channel_build/batch/release'
,
BatchPublishVersion
.
as_view
()),
url
(
r'^channel_build/version/create'
,
VersionCreate
.
as_view
()),
url
(
r'^suggestion/list$'
,
SuggestionListView
.
as_view
())
url
(
r'^suggestion/list$'
,
SuggestionListView
.
as_view
()),
# 画报相关
url
(
r'^pictorial/list$'
,
PictorialListView
.
as_view
()),
url
(
r'^pictorial/list/update$'
,
PictorialListView
.
as_view
()),
url
(
r'^pictorial/get$'
,
PictorialUpdateOrCreate
.
as_view
()),
url
(
r'^pictorial/create$'
,
PictorialUpdateOrCreate
.
as_view
()),
url
(
r'^pictorial/topics$'
,
PictorialTopics
.
as_view
()),
url
(
r'^pictorial/user/list$'
,
PictorialUserList
.
as_view
()),
]
search_urlpatterns
=
[
url
(
r'search/group$'
,
GroupSearchView
.
as_view
()),
url
(
r'search/country$'
,
CountrySearchView
.
as_view
()),
url
(
r'search/user$'
,
UserSearchView
.
as_view
()),
url
(
r'search/tag$'
,
TagSearchView
.
as_view
()),
...
...
@@ -139,6 +140,7 @@ search_urlpatterns = [
url
(
r'search/city$'
,
CitySearchView
.
as_view
()),
url
(
r'search/topic$'
,
TopicSearchView
.
as_view
()),
url
(
r'search/tagtype$'
,
TagTypeSearchView
.
as_view
()),
url
(
r'search/pictorial$'
,
PictorialSearchView
.
as_view
()),
]
common_urlpatterns
=
[
...
...
api/user.py
View file @
62d18d1c
...
...
@@ -18,12 +18,12 @@ from utils.pic_tools import tailor_image
class
UserListView
(
APIView
):
def
get
(
self
,
request
):
group_id
=
request
.
GET
.
get
(
'group
_id'
,
''
)
pictorial_id
=
request
.
GET
.
get
(
'pictorial
_id'
,
''
)
page
=
int
(
request
.
GET
.
get
(
'page'
,
1
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
filter
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
""
))
if
group
_id
:
filter
.
update
({
'
group_id'
:
group
_id
})
filter
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
'{}'
))
if
pictorial
_id
:
filter
.
update
({
'
pictorial_id'
:
pictorial
_id
})
try
:
data
=
self
.
rpc
[
'venus/sun/user/list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
...
...
@@ -72,6 +72,7 @@ class UserUpdateOrCreate(APIView):
'phone'
:
request
.
POST
.
get
(
'phone'
),
'email'
:
request
.
POST
.
get
(
'email'
),
'gender'
:
request
.
POST
.
get
(
'gender'
),
'is_tcc'
:
int
(
request
.
POST
.
get
(
'is_tcc'
,
0
)),
}
try
:
...
...
@@ -84,16 +85,16 @@ class UserUpdateOrCreate(APIView):
}
class
UserGroupView
(
APIView
):
class
PictorialUserList
(
APIView
):
def
get
(
self
,
request
):
user_id
=
request
.
GET
.
get
(
'id'
)
id_
=
request
.
GET
.
get
(
'id'
)
offset
=
int
(
request
.
GET
.
get
(
'page'
,
0
))
count
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
filters
=
{
'
user_id'
:
user_id
}
filters
=
{
'
pictorial_id'
:
id_
}
try
:
data
=
self
.
rpc
[
'venus/sun/
group/user/list'
](
filters
=
filters
,
offset
=
(
offset
-
1
)
*
count
,
limi
t
=
count
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/
pictorial/user/list'
](
filters
=
filters
,
offset
=
(
offset
-
1
)
*
count
,
coun
t
=
count
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取
小组用户详情
失败
%
s'
,
e
)
error_logger
.
error
(
u'获取
画报用户列表
失败
%
s'
,
e
)
raise
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