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
8c3eaa31
Commit
8c3eaa31
authored
Sep 05, 2019
by
zhongshangwu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into shangwu/feature-skin
parents
de7749be
dc54a451
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
0 deletions
+79
-0
skin_check.py
api/skin_check.py
+3
-0
tag.py
api/tag.py
+72
-0
urls.py
api/urls.py
+4
-0
No files found.
api/skin_check.py
View file @
8c3eaa31
...
...
@@ -101,6 +101,9 @@ class SkinCheckConfig(APIView):
return
text
.
replace
(
" "
,
""
)
def
_input_string_check
(
self
,
text
,
check_str
):
# 允许输入为空
if
not
text
:
return
True
"""
输入内容标签符号校验,是否都是 check_str
:param text:
...
...
api/tag.py
View file @
8c3eaa31
...
...
@@ -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
):
...
...
@@ -254,3 +255,74 @@ class SearchDefaultKeyword(APIView):
error_logger
.
error
(
u'更新搜索默认关键字失败
%
s'
,
e
)
raise
return
data
class
TagSetListView
(
APIView
):
def
get
(
self
,
request
):
offset
=
int
(
request
.
GET
.
get
(
'offset'
,
1
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
q
=
request
.
GET
.
get
(
'q'
,
""
)
type_
=
request
.
GET
.
get
(
'type'
,
""
)
try
:
data
=
self
.
rpc
[
'venus/sun/tag_set/list'
](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
q
=
q
,
type_
=
type_
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取词集列表失败
%
s'
,
e
)
raise
return
data
class
TagSetDeleteView
(
APIView
):
def
post
(
self
,
request
):
tag_set_id
=
request
.
POST
.
get
(
"id"
)
try
:
data
=
self
.
rpc
[
'venus/sun/tag_set/delete'
](
tag_set_id
=
tag_set_id
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'删除词集失败
%
s'
,
e
)
raise
return
{
"message"
:
"删除成功"
,
"code"
:
200
}
class
TagSetUpdateOrCreateView
(
APIView
):
def
post
(
self
,
request
):
tag_set_id
=
int
(
request
.
POST
.
get
(
"id"
,
0
)
or
0
)
name
=
request
.
POST
.
get
(
"name"
,
""
)
tag_ids
=
json
.
loads
(
request
.
POST
.
get
(
"tag_ids"
,
'[]'
))
if
tag_set_id
:
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
:
if
e
.
error
==
ERROR
.
TAG_SET_HAD_EXIST
:
return
{
'message'
:
e
.
message
,
'code'
:
500
}
else
:
error_logger
.
error
(
u'更新词集失败
%
s'
,
e
)
raise
return
{
"message"
:
"更新成功"
,
"code"
:
200
}
else
:
try
:
data
=
self
.
rpc
[
'venus/sun/tag_set/create'
](
name
=
name
,
tag_ids
=
tag_ids
)
.
unwrap
()
except
Exception
as
e
:
if
e
.
error
==
ERROR
.
TAG_SET_HAD_EXIST
:
return
{
'message'
:
e
.
message
,
'code'
:
500
}
else
:
error_logger
.
error
(
u'创建词集失败
%
s'
,
e
)
raise
return
{
"message"
:
"创建成功"
,
"code"
:
200
}
api/urls.py
View file @
8c3eaa31
...
...
@@ -110,6 +110,10 @@ urlpatterns = [
url
(
r'^tag/tagtype/create$'
,
TagTypeUpdateOrCreateView
.
as_view
()),
url
(
r'^tag/tagtype/detail$'
,
TagTypeUpdateOrCreateView
.
as_view
()),
url
(
r'^tag_set/list$'
,
TagSetListView
.
as_view
()),
url
(
r'^tag_set/create$'
,
TagSetUpdateOrCreateView
.
as_view
()),
url
(
r'^tag_set/delete$'
,
TagSetDeleteView
.
as_view
()),
# 扫脸相关
url
(
r'^face/star/create$'
,
FaceStarEdit
.
as_view
()),
url
(
r'^face/star/list$'
,
StarListView
.
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