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
a8eb08b7
Commit
a8eb08b7
authored
Aug 30, 2019
by
钟尚武
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'shangwu/hotfix-tag-set' into 'test'
词集接口增加错误处理 See merge request
!337
parents
c5f471ff
11671c3b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
8 deletions
+24
-8
tag.py
api/tag.py
+24
-8
No files found.
api/tag.py
View file @
a8eb08b7
...
...
@@ -6,6 +6,7 @@
import
json
from
utils.base
import
APIView
,
get_offset_count
from
utils.logger
import
error_logger
from
alpha_types.venus.error
import
ERROR
class
TagListView
(
APIView
):
...
...
@@ -281,8 +282,9 @@ class TagSetDeleteView(APIView):
error_logger
.
error
(
u'删除词集失败
%
s'
,
e
)
raise
return
{
"status"
:
1
}
"message"
:
"删除成功"
,
"code"
:
200
}
class
TagSetUpdateOrCreateView
(
APIView
):
...
...
@@ -296,17 +298,31 @@ class TagSetUpdateOrCreateView(APIView):
try
:
data
=
self
.
rpc
[
'venus/sun/tag_set/update'
](
tag_set_id
=
tag_set_id
,
name
=
name
,
tag_ids
=
tag_ids
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'更新词集失败
%
s'
,
e
)
raise
if
e
.
error
==
ERROR
.
TAG_SET_HAD_EXIST
:
return
{
'message'
:
e
.
message
,
'code'
:
500
}
else
:
error_logger
.
error
(
u'更新词集失败
%
s'
,
e
)
raise
return
{
"status"
:
1
"message"
:
"更新成功"
,
"code"
:
200
}
else
:
try
:
data
=
self
.
rpc
[
'venus/sun/tag_set/create'
](
name
=
name
,
tag_ids
=
tag_ids
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'创建词集失败
%
s'
,
e
)
raise
if
e
.
error
==
ERROR
.
TAG_SET_HAD_EXIST
:
return
{
'message'
:
e
.
message
,
'code'
:
500
}
else
:
error_logger
.
error
(
u'创建词集失败
%
s'
,
e
)
raise
return
{
"status"
:
1
"message"
:
"创建成功"
,
"code"
:
200
}
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