Commit b1561973 authored by 张英杰's avatar 张英杰

Merge branch 'feature/skin_check' into 'test'

sun 测肤变更数据接口

See merge request alpha/sun!293
parents 89ec5ee2 5bb1c95a
......@@ -17,7 +17,7 @@ from alpha_types.venus.enum import (
)
from utils.base import APIView, get_offset_count
from utils.logger import error_logger
from utils.logger import error_logger, info_logger
class SkinCheckPictorial(APIView):
......@@ -37,16 +37,36 @@ class SkinCheckPictorial(APIView):
return data
def post(self, request):
"""
榜单信息创建 or 更新
:param request:
:return:
"""
_data = json.loads(request.POST.get("pictorial_info") or "[]")
# 对变更数据做一层封装
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
for info in _data:
_skin_classify = info.get("skin_classify", "")
if _skin_classify in SKIN_ALL_CLASSIFY:
_data = {
"skin_classify": _skin_classify,
"url": info.get("url", ""),
"content": info.get("content", ""),
}
modify_data.append(_data)
info_logger.info("skin_check pictorial modify data: {}".format(json.dumps(modify_data)))
if 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"操作成功",
......
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