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
b96e6362
Commit
b96e6362
authored
Jun 26, 2019
by
杨成林
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test' into 'dev'
Test See merge request
alpha/sun!216
parents
dab83f29
d4cbfc27
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
147 additions
and
7 deletions
+147
-7
operation.py
api/operation.py
+20
-0
pictorial.py
api/pictorial.py
+51
-1
tag.py
api/tag.py
+44
-2
topic.py
api/topic.py
+18
-1
urls.py
api/urls.py
+8
-0
user.py
api/user.py
+6
-3
No files found.
api/operation.py
View file @
b96e6362
...
@@ -188,3 +188,23 @@ class OperationList(APIView):
...
@@ -188,3 +188,23 @@ class OperationList(APIView):
raise
raise
return
data
return
data
class
OperationSearchKeyword
(
APIView
):
def
get
(
self
,
request
):
try
:
data
=
self
.
rpc
[
'venus/sun/operation/search_keyword/get'
]()
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取搜索热门词失败
%
s'
,
e
)
raise
return
data
def
post
(
self
,
request
):
update
=
json
.
loads
(
request
.
POST
.
get
(
'update'
))
try
:
data
=
self
.
rpc
[
'venus/sun/operation/search_keyword/edit'
](
data
=
update
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取搜索热门词失败
%
s'
,
e
)
raise
return
data
api/pictorial.py
View file @
b96e6362
...
@@ -61,7 +61,8 @@ class PictorialUpdateOrCreate(APIView):
...
@@ -61,7 +61,8 @@ class PictorialUpdateOrCreate(APIView):
'collection_tag_ids'
:
collection_tag_ids
,
'collection_tag_ids'
:
collection_tag_ids
,
'is_home_recommend'
:
int
(
request
.
POST
.
get
(
'is_home_recommend'
,
0
)),
'is_home_recommend'
:
int
(
request
.
POST
.
get
(
'is_home_recommend'
,
0
)),
'add_score'
:
int
(
request
.
POST
.
get
(
'add_score'
,
0
)),
'add_score'
:
int
(
request
.
POST
.
get
(
'add_score'
,
0
)),
'is_public'
:
True
if
request
.
POST
.
get
(
'is_public'
)
==
"true"
else
False
'is_public'
:
True
if
request
.
POST
.
get
(
'is_public'
)
==
"true"
else
False
,
'is_feed'
:
int
(
request
.
POST
.
get
(
'is_feed'
,
0
))
}
}
try
:
try
:
...
@@ -94,3 +95,51 @@ class PictorialTopics(APIView):
...
@@ -94,3 +95,51 @@ class PictorialTopics(APIView):
return
{
return
{
'message'
:
'更新成功'
'message'
:
'更新成功'
}
}
class
PictorialFeedlListView
(
APIView
):
def
get
(
self
,
request
):
order_by
=
request
.
GET
.
get
(
'order_by'
,
"-id"
)
offset
=
int
(
request
.
GET
.
get
(
'page'
,
1
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
try
:
data
=
self
.
rpc
[
'venus/sun/pictorial/feed/list'
](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
order_by
=
order_by
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取画报列表失败
%
s'
,
e
)
raise
return
data
class
PictorialFeedlRank
(
APIView
):
"""修改画报首页like流rank"""
def
post
(
self
,
request
):
id_
=
request
.
POST
.
get
(
'id'
)
rank
=
int
(
request
.
POST
.
get
(
'rank'
))
try
:
self
.
rpc
[
'venus/sun/pictorial/feed/rank'
](
id_
=
id_
,
rank
=
rank
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'编辑
%
信息失败
%
s'
%
(
e
))
raise
return
{
'message'
:
'更新成功'
}
class
PictorialFeedDelete
(
APIView
):
"""删除画报首页like流"""
def
post
(
self
,
request
):
ids
=
json
.
loads
(
request
.
POST
.
get
(
'ids'
,
'[]'
))
try
:
self
.
rpc
[
'venus/sun/pictorial/feed/delete'
](
ids
=
ids
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'删除信息失败
%
s'
%
(
e
))
raise
return
{
'message'
:
'删除成功'
}
\ No newline at end of file
api/tag.py
View file @
b96e6362
...
@@ -137,9 +137,10 @@ class TagRegisterUpdateView(APIView):
...
@@ -137,9 +137,10 @@ class TagRegisterUpdateView(APIView):
return
data
return
data
def
post
(
self
,
request
):
def
post
(
self
,
request
):
ids
=
request
.
POST
.
get
(
'tag_ids'
)
male_ids
=
request
.
POST
.
get
(
'male_ids'
)
female_ids
=
request
.
POST
.
get
(
'female_ids'
)
try
:
try
:
self
.
rpc
[
'venus/sun/tag/register_tag/update'
](
ids
=
ids
)
.
unwrap
()
self
.
rpc
[
'venus/sun/tag/register_tag/update'
](
female_ids
=
female_ids
,
male_ids
=
male_
ids
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
error_logger
.
error
(
u'配置失败'
)
error_logger
.
error
(
u'配置失败'
)
raise
raise
...
@@ -198,3 +199,44 @@ class TagFilterDelete(APIView):
...
@@ -198,3 +199,44 @@ class TagFilterDelete(APIView):
return
{
'message'
:
'操作失败'
}
return
{
'message'
:
'操作失败'
}
return
{
'message'
:
'操作成功'
}
return
{
'message'
:
'操作成功'
}
class
TagSearchRecommendKeyword
(
APIView
):
def
get
(
self
,
request
):
try
:
data
=
self
.
rpc
[
'venus/sun/tag/recommend_keyword/get'
]()
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取搜索热门词失败
%
s'
,
e
)
raise
return
data
def
post
(
self
,
request
):
# 如果有id 走update 。 否则走创建
id
=
request
.
POST
.
get
(
'id'
,
None
)
update
=
request
.
POST
.
get
(
'update'
,
''
)
try
:
data
=
self
.
rpc
[
'venus/sun/tag/recommend_keyword/edit'
](
data
=
update
,
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取搜索热门词失败
%
s'
,
e
)
raise
return
data
class
SearchDefaultKeyword
(
APIView
):
def
get
(
self
,
request
):
try
:
data
=
self
.
rpc
[
'venus/sun/tag/search_default_keyword/get'
]()
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取搜索默认关键字失败
%
s'
,
e
)
raise
return
data
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
,
None
)
update
=
request
.
POST
.
get
(
'update'
,
''
)
try
:
data
=
self
.
rpc
[
'venus/sun/tag/search_default_keyword/edit'
](
data
=
update
,
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'更新搜索默认关键字失败
%
s'
,
e
)
raise
return
data
api/topic.py
View file @
b96e6362
...
@@ -40,7 +40,7 @@ class TopicListView(APIView):
...
@@ -40,7 +40,7 @@ class TopicListView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/topic/list'
](
data
=
self
.
rpc
[
'venus/sun/topic/list'
](
topic_ids
=
topic_ids
topic_ids
=
topic_ids
,
pictorial_id
=
pictorial_id
)
.
unwrap
()
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
error_logger
.
error
(
u'获取帖子列表失败
%
s'
,
e
)
error_logger
.
error
(
u'获取帖子列表失败
%
s'
,
e
)
...
@@ -227,3 +227,20 @@ class TopicRelatePictorialInfo(APIView):
...
@@ -227,3 +227,20 @@ class TopicRelatePictorialInfo(APIView):
error_logger
.
error
(
u'获取帖子画报列表失败
%
s'
,
e
)
error_logger
.
error
(
u'获取帖子画报列表失败
%
s'
,
e
)
raise
raise
return
{
'data'
:
data
}
return
{
'data'
:
data
}
class
TopicBallot
(
APIView
):
def
post
(
self
,
request
):
id_
=
request
.
POST
.
get
(
'id'
)
pictorial_id
=
request
.
POST
.
get
(
'pictorial_id'
)
ballot_num
=
request
.
POST
.
get
(
'ballot_num'
)
try
:
self
.
rpc
[
'venus/sun/topic/ballot'
](
id_
=
id_
,
pictorial_id
=
pictorial_id
,
ballot_num
=
ballot_num
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'批量更新帖子失败
%
s'
,
e
)
raise
return
{
"message"
:
"更新成功"
}
api/urls.py
View file @
b96e6362
...
@@ -58,6 +58,7 @@ urlpatterns = [
...
@@ -58,6 +58,7 @@ urlpatterns = [
url
(
r'^topic/reply/batch_delete$'
,
ReplyUpdateOrCreateView
.
as_view
()),
url
(
r'^topic/reply/batch_delete$'
,
ReplyUpdateOrCreateView
.
as_view
()),
url
(
r'^topic/reply/create$'
,
ReplyCreate
.
as_view
()),
url
(
r'^topic/reply/create$'
,
ReplyCreate
.
as_view
()),
url
(
r'^topic/related_pictorial_info$'
,
TopicRelatePictorialInfo
.
as_view
()),
url
(
r'^topic/related_pictorial_info$'
,
TopicRelatePictorialInfo
.
as_view
()),
url
(
r'^topic/ballot$'
,
TopicBallot
.
as_view
()),
# star相关
# star相关
url
(
r'^celebrity/list$'
,
CelebrityListView
.
as_view
()),
url
(
r'^celebrity/list$'
,
CelebrityListView
.
as_view
()),
...
@@ -94,6 +95,8 @@ urlpatterns = [
...
@@ -94,6 +95,8 @@ urlpatterns = [
url
(
r'^tag/filter/list$'
,
TagFilterList
.
as_view
()),
url
(
r'^tag/filter/list$'
,
TagFilterList
.
as_view
()),
url
(
r'^tag/filter/add$'
,
TagFilterCreate
.
as_view
()),
url
(
r'^tag/filter/add$'
,
TagFilterCreate
.
as_view
()),
url
(
r'^tag/filter/delete$'
,
TagFilterDelete
.
as_view
()),
url
(
r'^tag/filter/delete$'
,
TagFilterDelete
.
as_view
()),
url
(
r'^tag/search_recommend_keyword$'
,
TagSearchRecommendKeyword
.
as_view
()),
url
(
r'^tag/search_default_keyword$'
,
SearchDefaultKeyword
.
as_view
()),
# 标签类型相关
# 标签类型相关
url
(
r'^tag/tagtype/list$'
,
TagTypeListView
.
as_view
()),
url
(
r'^tag/tagtype/list$'
,
TagTypeListView
.
as_view
()),
...
@@ -139,6 +142,10 @@ urlpatterns = [
...
@@ -139,6 +142,10 @@ urlpatterns = [
url
(
r'^pictorial/create$'
,
PictorialUpdateOrCreate
.
as_view
()),
url
(
r'^pictorial/create$'
,
PictorialUpdateOrCreate
.
as_view
()),
url
(
r'^pictorial/topics$'
,
PictorialTopics
.
as_view
()),
url
(
r'^pictorial/topics$'
,
PictorialTopics
.
as_view
()),
url
(
r'^pictorial/user/list$'
,
PictorialUserList
.
as_view
()),
url
(
r'^pictorial/user/list$'
,
PictorialUserList
.
as_view
()),
url
(
r'^pictorial/feed/list$'
,
PictorialFeedlListView
.
as_view
()),
url
(
r'^pictorial/feed/rank$'
,
PictorialFeedlRank
.
as_view
()),
url
(
r'^pictorial/feed/delete$'
,
PictorialFeedDelete
.
as_view
()),
#运营位
#运营位
url
(
r'^topic/home_recommend/list'
,
TopicHomeRecommendList
.
as_view
()),
url
(
r'^topic/home_recommend/list'
,
TopicHomeRecommendList
.
as_view
()),
...
@@ -149,6 +156,7 @@ urlpatterns = [
...
@@ -149,6 +156,7 @@ urlpatterns = [
url
(
r'^operation/edit'
,
OperationEdit
.
as_view
()),
url
(
r'^operation/edit'
,
OperationEdit
.
as_view
()),
url
(
r'^operation/list'
,
OperationList
.
as_view
()),
url
(
r'^operation/list'
,
OperationList
.
as_view
()),
url
(
r'^operation/delete'
,
OperationDelete
.
as_view
()),
url
(
r'^operation/delete'
,
OperationDelete
.
as_view
()),
url
(
r'^operation/search_keyword$'
,
OperationSearchKeyword
.
as_view
()),
# 工具
# 工具
url
(
r'^tools/virtual_vote$'
,
VirtualVote
.
as_view
()),
url
(
r'^tools/virtual_vote$'
,
VirtualVote
.
as_view
()),
...
...
api/user.py
View file @
b96e6362
...
@@ -19,13 +19,16 @@ from utils.pic_tools import tailor_image
...
@@ -19,13 +19,16 @@ from utils.pic_tools import tailor_image
class
UserListView
(
APIView
):
class
UserListView
(
APIView
):
def
get
(
self
,
request
):
def
get
(
self
,
request
):
pictorial_id
=
request
.
GET
.
get
(
'pictorial_id'
,
''
)
pictorial_id
=
request
.
GET
.
get
(
'pictorial_id'
,
''
)
gender
=
request
.
GET
.
get
(
'gender'
,
None
)
page
=
int
(
request
.
GET
.
get
(
'page'
,
1
))
page
=
int
(
request
.
GET
.
get
(
'page'
,
1
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
filter
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
'{}'
))
filter
s
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
'{}'
))
if
pictorial_id
:
if
pictorial_id
:
filter
.
update
({
'pictorial_id'
:
pictorial_id
})
filters
.
update
({
'pictorial_id'
:
pictorial_id
})
if
gender
:
filters
.
update
({
'gender'
:
gender
})
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/user/list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/user/list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
s
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
error_logger
.
error
(
u'获取用户列表失败
%
s'
,
e
)
error_logger
.
error
(
u'获取用户列表失败
%
s'
,
e
)
raise
raise
...
...
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