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
74ee15dc
Commit
74ee15dc
authored
Dec 11, 2018
by
JackieZhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
扫脸
parent
40e13195
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
2 deletions
+78
-2
face_star.py
api/face_star.py
+49
-1
urls.py
api/urls.py
+4
-1
face_image_upload.js
vu/src/api/face_image_upload.js
+25
-0
No files found.
api/face_star.py
View file @
74ee15dc
...
...
@@ -5,15 +5,28 @@
from
utils.base
import
APIView
from
utils.logger
import
error_logger
class
FaceStarEdit
(
APIView
):
def
get
(
self
,
request
):
_id
=
request
.
GET
.
get
(
'id'
)
try
:
data
=
self
.
rpc
[
'mercury/face/star/get'
](
_id
=
_id
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取
%
d 明星信息失败
%
s '
%
(
_id
,
e
))
raise
return
{
'data'
:
data
}
def
post
(
self
,
request
):
name
=
request
.
POST
.
get
(
'name'
)
sex
=
request
.
POST
.
get
(
'sex'
)
ordinary_image_url
=
request
.
POST
.
get
(
'ordinary_image_url'
)
modeling_obj_url
=
request
.
POST
.
get
(
'modeling_obj_url'
)
try
:
self
.
rpc
[
'mercury/face/create_star'
](
name
=
name
,
...
...
@@ -23,6 +36,41 @@ class FaceStarEdit(APIView):
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
'message'
:
'创建成功'
}
class
StarListView
(
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/star/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
=
request
.
POST
.
get
(
'ids'
,
''
)
.
split
()
tp
=
request
.
POST
.
get
(
'type'
,
''
)
updates
=
{}
if
tp
==
'offline'
:
updates
[
'is_online'
]
=
0
else
:
updates
[
'is_online'
]
=
1
try
:
self
.
rpc
[
'mercury/face/star/update'
](
ids
,
**
updates
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'批量更新明星列表失败
%
s'
,
e
)
raise
return
{
"message"
:
"更新成功"
}
api/urls.py
View file @
74ee15dc
...
...
@@ -87,7 +87,10 @@ urlpatterns = [
url
(
r'^tag/create$'
,
TagUpdateOrCreateView
.
as_view
()),
url
(
r'^tag/detail$'
,
TagUpdateOrCreateView
.
as_view
()),
url
(
r'^face/star/create'
,
FaceStarEdit
.
as_view
()),
url
(
r'^face/star/create$'
,
FaceStarEdit
.
as_view
()),
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
()),
]
search_urlpatterns
=
[
...
...
vu/src/api/face_image_upload.js
View file @
74ee15dc
...
...
@@ -7,3 +7,28 @@ export function faceStarCreate(data) {
data
})
}
export
function
fetchList
(
query
)
{
return
request
({
url
:
'/api/face/star/list'
,
method
:
'get'
,
params
:
query
})
}
export
function
OffLineOrOnLine
(
data
)
{
console
.
log
(
data
)
return
request
({
url
:
'/api/face/list/update'
,
method
:
'post'
,
data
})
}
export
function
fetchPushDetail
(
id
)
{
return
request
({
url
:
'/api/face/star/detail'
,
method
:
'get'
,
params
:
{
id
}
})
}
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