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
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
!283
parents
64ff09c5
ef142bd0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
reply.py
api/reply.py
+20
-3
urls.py
api/urls.py
+1
-0
No files found.
api/reply.py
View file @
1c4922c8
...
@@ -24,11 +24,12 @@ class ReplyUpdateOrCreateView(APIView):
...
@@ -24,11 +24,12 @@ class ReplyUpdateOrCreateView(APIView):
return
data
return
data
def
post
(
self
,
request
):
def
post
(
self
,
request
):
reply_ids
=
json
.
loads
(
request
.
POST
.
get
(
'reply_ids'
,
[]))
reply_ids
=
json
.
loads
(
request
.
POST
.
get
(
'reply_ids'
,
[]))
try
:
try
:
self
.
rpc
[
'venus/sun/reply/batch_delete'
](
ids
=
reply_ids
)
.
unwrap
()
self
.
rpc
[
'venus/sun/reply/batch_delete'
](
ids
=
reply_ids
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
error_logger
.
error
(
u'批量更新
帖子
失败
%
s'
,
e
)
error_logger
.
error
(
u'批量更新
回复
失败
%
s'
,
e
)
raise
raise
return
{
return
{
'message'
:
'操作成功'
'message'
:
'操作成功'
...
@@ -56,7 +57,24 @@ class ReplyCreate(APIView):
...
@@ -56,7 +57,24 @@ class ReplyCreate(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/reply/edit'
](
id
=
None
,
data
=
data
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/reply/edit'
](
id
=
None
,
data
=
data
)
.
unwrap
()
except
Exception
as
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
:
except
Exception
as
e
:
error_logger
.
error
(
u'编辑帖子失败
%
s'
,
e
)
error_logger
.
error
(
u'编辑帖子失败
%
s'
,
e
)
raise
raise
return
{
'data'
:
data
}
\ No newline at end of file
return
{
'message'
:
'操作成功'
}
api/urls.py
View file @
1c4922c8
...
@@ -218,6 +218,7 @@ urlpatterns = [
...
@@ -218,6 +218,7 @@ urlpatterns = [
url
(
r'^reply/list$'
,
ReplyUpdateOrCreateView
.
as_view
()),
url
(
r'^reply/list$'
,
ReplyUpdateOrCreateView
.
as_view
()),
url
(
r'^reply/batch_delete$'
,
ReplyUpdateOrCreateView
.
as_view
()),
url
(
r'^reply/batch_delete$'
,
ReplyUpdateOrCreateView
.
as_view
()),
url
(
r'^reply/create$'
,
ReplyCreate
.
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