Commit 85105a0e authored by 张英杰's avatar 张英杰

sun增加测肤

parent 6277338f
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alpha_types.venus.enum import (
SKIN_ALL_CLASSIFY,
SKIN_CHECK_ITEMIZE_TYPE,
SKIN_QUALITY_COLOR_DESC,
SKIN_QUALITY_TEMPERATURE,
SKIN_QUALITY_OIL_LEVEL,
SKIN_PORE_SEVERITY,
SKIN_ROUGHNESS_TYPE,
SKIN_ACNE_TYPE,
SKIN_BLACK_HEADS_TYPE,
SKIN_DARK_CIRCLE_TYPE,
)
from utils.base import APIView, get_offset_count
from utils.logger import error_logger
class SkinCheckPictorial(APIView):
def get(self, request):
try:
data = self.rpc['venus/sun/skin_check/get_pictorial_info']().unwrap()
for item in data:
if item.get("skin_classify") == SKIN_ALL_CLASSIFY.SKIN_QUALITY:
item["skin_classifiy_desc"] = u"肤色"
except Exception as e:
error_logger.error(u'获取测肤榜单配置失败%s', e)
raise
return data
def post(self, request):
modify_data = []
try:
self.rpc['venus/sun/skin_check/pictorial_update_or_create'](
modify_data=modify_data
).unwrap()
except Exception as e:
error_logger.error(u'变更测肤榜单配置失败%s', e)
raise
return {
"message": u"操作成功",
}
class SkinCheckConfig(APIView):
def get(self, request):
try:
data = self.rpc['venus/sun/skin_check/all_config']().unwrap()
except Exception as e:
error_logger.error(u'获取测肤配置失败%s', e)
raise
return data
def post(self, request):
modify_data = []
try:
self.rpc['venus/sun/skin_check/config_update_or_create'](
modify_data=modify_data
).unwrap()
except Exception as e:
error_logger.error(u'变更测肤配置失败%s', e)
raise
return {
"message": u"操作成功",
}
......@@ -31,6 +31,7 @@ from .product import *
from .category import *
from .classify import *
from .effect import *
from .skin_check import *
from .reply import *
......@@ -224,6 +225,10 @@ urlpatterns = [
url(r'^reply/manage/list$', ReplyManageListView.as_view()),
url(r'^reply/manage/create$', ReplyManageCreateView.as_view()),
url(r'^reply/manage/batch/update$', ReplyManageBatchUpdate.as_view()),
# 测肤
url(r'^skin_check/pictorial$', SkinCheckPictorial.as_view()),
url(r'^skin_check/config', SkinCheckConfig.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