Commit 72acbb89 authored by 张英杰's avatar 张英杰

Merge branch 'feature/skin_check' into 'test'

修改配置

See merge request alpha/sun!295
parents b9618efd 732e1d7a
...@@ -86,6 +86,20 @@ class SkinCheckConfig(APIView): ...@@ -86,6 +86,20 @@ class SkinCheckConfig(APIView):
"black_head": {}, # 黑头 "black_head": {}, # 黑头
"dark_circle": {}, # 黑眼圈 "dark_circle": {}, # 黑眼圈
"acne": {}, # 痘痘 "acne": {}, # 痘痘
"type_1": [
SKIN_CHECK_ITEMIZE_TYPE.SKIN_COLOR,
SKIN_CHECK_ITEMIZE_TYPE.TEMPERATURE,
SKIN_CHECK_ITEMIZE_TYPE.OIL_LEVEL,
],
"type_2": [
SKIN_CHECK_ITEMIZE_TYPE.SEVERITY,
SKIN_CHECK_ITEMIZE_TYPE.ROUGHNESS,
],
"type_3": [
SKIN_CHECK_ITEMIZE_TYPE.BLACK_HEAD,
SKIN_CHECK_ITEMIZE_TYPE.DARK_CIRCLE,
SKIN_CHECK_ITEMIZE_TYPE.ACNE,
],
} }
try: try:
...@@ -107,16 +121,37 @@ class SkinCheckConfig(APIView): ...@@ -107,16 +121,37 @@ class SkinCheckConfig(APIView):
return data return data
def post(self, request): def post(self, request):
"""
配置 创建/修改
:param request:
:return:
"""
_data = json.loads(request.POST.get("config_info") or "[]")
# 对变更数据做一层封装
modify_data = [] modify_data = []
try: for info in _data:
self.rpc['venus/sun/skin_check/config_update_or_create']( _data = {
modify_data=modify_data "skin_check_itemize_type": info.get("owner_enum", ""),
).unwrap() "enum_value": info.get("enum_value", ""),
"fitting": info.get("fitting", ""),
"dread": info.get("fitting", ""),
"fitting_suggest": info.get("fitting_suggest", ""),
"dread_suggest": info.get("dread_suggest", "")
}
modify_data.append(_data)
info_logger.info("skin_check config modify data: {}".format(json.dumps(modify_data)))
except Exception as e: if modify_data:
error_logger.error(u'变更测肤配置失败%s', e) try:
raise 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 { return {
"message": u"操作成功", "message": u"操作成功",
......
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