Commit 87c0e7c0 authored by zhanglu's avatar zhanglu

Merge branch 'dev' into 'test'

Dev

See merge request alpha/sun!55
parents 17f9d47a dbe08dcb
......@@ -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}
......@@ -72,3 +72,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
......@@ -98,6 +98,12 @@ 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()),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment