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
1c4922c8
Commit
1c4922c8
authored
Aug 06, 2019
by
杨成林
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ycl/fix_dev' into 'dev'
reply vote See merge request
alpha/sun!283
parents
64ff09c5
ef142bd0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
reply.py
api/reply.py
+20
-2
urls.py
api/urls.py
+1
-0
No files found.
api/reply.py
View file @
1c4922c8
...
...
@@ -24,11 +24,12 @@ class ReplyUpdateOrCreateView(APIView):
return
data
def
post
(
self
,
request
):
reply_ids
=
json
.
loads
(
request
.
POST
.
get
(
'reply_ids'
,
[]))
try
:
self
.
rpc
[
'venus/sun/reply/batch_delete'
](
ids
=
reply_ids
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'批量更新
帖子
失败
%
s'
,
e
)
error_logger
.
error
(
u'批量更新
回复
失败
%
s'
,
e
)
raise
return
{
'message'
:
'操作成功'
...
...
@@ -57,6 +58,23 @@ class ReplyCreate(APIView):
try
:
data
=
self
.
rpc
[
'venus/sun/reply/edit'
](
id
=
None
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'编辑
帖子
失败
%
s'
,
e
)
error_logger
.
error
(
u'编辑
评论
失败
%
s'
,
e
)
raise
return
{
'data'
:
data
}
class
ReplyVote
(
APIView
):
def
post
(
self
,
request
):
reply_id
=
request
.
POST
.
get
(
'reply_id'
)
vote_num
=
request
.
POST
.
get
(
'vote_num'
)
try
:
self
.
rpc
[
'venus/sun/reply/vote'
](
reply_id
=
reply_id
,
vote_num
=
vote_num
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'编辑帖子失败
%
s'
,
e
)
raise
return
{
'message'
:
'操作成功'
}
api/urls.py
View file @
1c4922c8
...
...
@@ -218,6 +218,7 @@ urlpatterns = [
url
(
r'^reply/list$'
,
ReplyUpdateOrCreateView
.
as_view
()),
url
(
r'^reply/batch_delete$'
,
ReplyUpdateOrCreateView
.
as_view
()),
url
(
r'^reply/create$'
,
ReplyCreate
.
as_view
()),
url
(
r'^reply/vote$'
,
ReplyVote
.
as_view
()),
]
...
...
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