Commit 3cf4253e authored by 王浩's avatar 王浩

Merge branch 'test' into 'master'

Alpha 1.3 上线

See merge request !65
parents e2dc1971 57ccac06
#! /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
......@@ -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
......@@ -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 = [
......
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