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
dbe08dcb
Commit
dbe08dcb
authored
Jan 28, 2019
by
王浩
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'haow/dev' into 'dev'
add face part api See merge request
alpha/sun!54
parents
235b9cca
a8f57eee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
1 deletion
+84
-1
face_star.py
api/face_star.py
+78
-1
urls.py
api/urls.py
+6
-0
No files found.
api/face_star.py
View file @
dbe08dcb
...
@@ -17,7 +17,7 @@ class FaceStarEdit(APIView):
...
@@ -17,7 +17,7 @@ class FaceStarEdit(APIView):
try
:
try
:
data
=
self
.
rpc
[
'mercury/face/star/get'
](
_id
=
_id
)
.
unwrap
()
data
=
self
.
rpc
[
'mercury/face/star/get'
](
_id
=
_id
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
error_logger
.
error
(
u'获取
%
d 明星信息失败
%
s '
%
(
_id
,
e
))
error_logger
.
error
(
u'获取
{id} 明星信息失败 {e} '
.
format
(
id
=
_id
,
e
=
e
))
raise
raise
return
{
'data'
:
data
}
return
{
'data'
:
data
}
...
@@ -72,3 +72,80 @@ class StarListView(APIView):
...
@@ -72,3 +72,80 @@ class StarListView(APIView):
return
{
return
{
"message"
:
"更新成功"
"message"
:
"更新成功"
}
}
class
FacePartEdit
(
APIView
):
def
get
(
self
,
request
):
_id
=
request
.
GET
.
get
(
'id'
)
try
:
data
=
self
.
rpc
[
'mercury/face/part/get'
](
_id
=
_id
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取 {id} 局部模型信息失败 {error} '
.
format
(
id
=
_id
,
error
=
e
))
raise
return
{
'data'
:
data
}
def
post
(
self
,
request
):
_id
=
request
.
POST
.
get
(
'id'
)
name
=
request
.
POST
.
get
(
'name'
)
model_id
=
request
.
POST
.
get
(
'model_id'
)
ordinary_image_url
=
request
.
POST
.
get
(
'ordinary_image_url'
)
part_type
=
request
.
POST
.
get
(
'part_type'
)
try
:
self
.
rpc
[
'mercury/face/part/create'
](
name
=
name
,
model_id
=
model_id
,
ordinary_image_url
=
ordinary_image_url
,
part_type
=
part_type
,
_id
=
_id
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
'message'
:
'创建成功'
}
class
FacePartListView
(
APIView
):
def
get
(
self
,
request
):
page
=
int
(
request
.
GET
.
get
(
'page'
,
1
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
filter
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
'{}'
))
try
:
data
=
self
.
rpc
[
'mercury/face/part/list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取局部模型列表失败
%
s'
,
e
)
raise
return
data
def
post
(
self
,
request
):
ids
=
json
.
loads
(
request
.
POST
.
get
(
'ids'
,
'[]'
))
updates
=
json
.
loads
(
request
.
POST
.
get
(
'updates'
,
'{}'
))
try
:
self
.
rpc
[
'mercury/face/part/batch/update'
](
ids
=
ids
,
updates
=
updates
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'批量更新局部模型列表失败
%
s'
,
e
)
raise
return
{
"message"
:
"更新成功"
}
class
FacePartTypeListView
(
APIView
):
def
get
(
self
,
request
):
page
=
int
(
request
.
GET
.
get
(
'page'
,
1
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
try
:
data
=
self
.
rpc
[
'mercury/face/part/type_list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取局部模型类型列表失败
%
s'
,
e
)
raise
return
data
api/urls.py
View file @
dbe08dcb
...
@@ -98,6 +98,12 @@ urlpatterns = [
...
@@ -98,6 +98,12 @@ urlpatterns = [
url
(
r'^face/star/list$'
,
StarListView
.
as_view
()),
url
(
r'^face/star/list$'
,
StarListView
.
as_view
()),
url
(
r'^face/star/list/update$'
,
StarListView
.
as_view
()),
url
(
r'^face/star/list/update$'
,
StarListView
.
as_view
()),
url
(
r'^face/star/detail$'
,
FaceStarEdit
.
as_view
()),
url
(
r'^face/star/detail$'
,
FaceStarEdit
.
as_view
()),
url
(
r'^face/part/detail$'
,
FacePartEdit
.
as_view
()),
url
(
r'^face/part/create$'
,
FacePartEdit
.
as_view
()),
url
(
r'^face/part/list$'
,
FacePartListView
.
as_view
()),
url
(
r'^face/part/list/update$'
,
FacePartListView
.
as_view
()),
url
(
r'^face/part/type_list$'
,
FacePartTypeListView
.
as_view
()),
# 文案相关
# 文案相关
url
(
r'^advertise/edit'
,
AdvertiseCreateView
.
as_view
()),
url
(
r'^advertise/edit'
,
AdvertiseCreateView
.
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