Commit 732e1d7a authored by 张英杰's avatar 张英杰

修改配置

parent 5bb1c95a
......@@ -86,6 +86,20 @@ class SkinCheckConfig(APIView):
"black_head": {}, # 黑头
"dark_circle": {}, # 黑眼圈
"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:
......@@ -107,16 +121,37 @@ class SkinCheckConfig(APIView):
return data
def post(self, request):
"""
配置 创建/修改
:param request:
:return:
"""
_data = json.loads(request.POST.get("config_info") or "[]")
# 对变更数据做一层封装
modify_data = []
try:
self.rpc['venus/sun/skin_check/config_update_or_create'](
modify_data=modify_data
).unwrap()
for info in _data:
_data = {
"skin_check_itemize_type": info.get("owner_enum", ""),
"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:
error_logger.error(u'变更测肤配置失败%s', e)
raise
if 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"操作成功",
......
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