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
3cf4253e
Commit
3cf4253e
authored
Feb 18, 2019
by
王浩
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test' into 'master'
Alpha 1.3 上线 See merge request
alpha/sun!65
parents
e2dc1971
57ccac06
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
111 additions
and
2 deletions
+111
-2
commons.py
api/commons.py
+21
-0
face_star.py
api/face_star.py
+81
-2
urls.py
api/urls.py
+9
-0
No files found.
api/commons.py
0 → 100644
View file @
3cf4253e
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "chenwei"
# Date: 2019/2/14
from
utils.base
import
APIView
from
utils.logger
import
error_logger
class
SuggestionListView
(
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
[
'venus/sun/suggestion/list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取建议列表失败
%
s'
,
e
)
raise
return
data
\ No newline at end of file
api/face_star.py
View file @
3cf4253e
...
...
@@ -17,7 +17,7 @@ class FaceStarEdit(APIView):
try
:
data
=
self
.
rpc
[
'mercury/face/star/get'
](
_id
=
_id
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取
%
d 明星信息失败
%
s '
%
(
_id
,
e
))
error_logger
.
error
(
u'获取
{id} 明星信息失败 {e} '
.
format
(
id
=
_id
,
e
=
e
))
raise
return
{
'data'
:
data
}
...
...
@@ -26,6 +26,7 @@ class FaceStarEdit(APIView):
_id
=
request
.
POST
.
get
(
'id'
)
name
=
request
.
POST
.
get
(
'name'
)
sex
=
request
.
POST
.
get
(
'sex'
)
model_type
=
request
.
POST
.
get
(
'model_type'
)
ordinary_image_url
=
request
.
POST
.
get
(
'ordinary_image_url'
)
modeling_uv_url
=
request
.
POST
.
get
(
'modeling_uv_url'
)
modeling_obj_url
=
request
.
POST
.
get
(
'modeling_obj_url'
)
...
...
@@ -36,7 +37,8 @@ class FaceStarEdit(APIView):
ordinary_image_url
=
ordinary_image_url
,
modeling_obj_url
=
modeling_obj_url
,
modeling_uv_url
=
modeling_uv_url
,
_id
=
_id
_id
=
_id
,
model_type
=
model_type
)
.
unwrap
()
except
Exception
as
e
:
raise
e
...
...
@@ -72,3 +74,80 @@ class StarListView(APIView):
return
{
"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 @
3cf4253e
...
...
@@ -19,6 +19,7 @@ from .upload import *
from
.token
import
*
from
.face_star
import
*
from
.advertise
import
*
from
.commons
import
*
urlpatterns
=
[
# 登陆,注销相关
...
...
@@ -100,11 +101,19 @@ urlpatterns = [
url
(
r'^face/star/list$'
,
StarListView
.
as_view
()),
url
(
r'^face/star/list/update$'
,
StarListView
.
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/list$'
,
AdvertiseListView
.
as_view
()),
url
(
r'^advertise/create$'
,
AdvertiseCreateView
.
as_view
()),
url
(
r'^suggestion/list$'
,
SuggestionListView
.
as_view
())
]
search_urlpatterns
=
[
...
...
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