Commit d444cb22 authored by 许俊鹏's avatar 许俊鹏

Merge branch 'xujunpeng/feature' into 'dev'

增加参数校验,限制参数大于0

See merge request !38
parents 9de6fe96 4ee01616
......@@ -16,6 +16,11 @@ class AdvertiseCreateView(APIView):
"invitees_num": request.POST.get('invitees_num'),
"unlocks_num": request.POST.get('unlocks_num'),
}
if int(data["invitees_num"]) < 1 or int(data["unlocks_num"]) < 1:
return {
'message': '数字非法,参数需要大于0',
'code': 500
}
try:
self.rpc['venus/sun/advertise/create_invite_rule'](pk_id=pk_id, data=data).unwrap()
except Exception as e:
......@@ -38,6 +43,7 @@ class AdvertiseCreateView(APIView):
data = self.rpc['venus/sun/advertise/get_advertise'](pk_id=pk_id).unwrap()
except Exception as e:
error_logger.error(u'文案获取失败%s', e)
raise
return data
......
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