From 279cb63a15cba11021743194aa82a071b11d0e05 Mon Sep 17 00:00:00 2001 From: luoning Date: Fri, 2 Feb 2018 21:42:08 +0800 Subject: [PATCH] =?UTF-8?q?[+]=20=E5=A2=9E=E5=8A=A0=E6=96=B0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3add=5Faward?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main.py b/src/main.py index 39dc0f3..f5da435 100644 --- a/src/main.py +++ b/src/main.py @@ -61,6 +61,15 @@ def add_awards(): return lottery.add_awards(b.request.json['awards']) +@app.route('/add_award') +def add_award(): + name = b.request.params.get('award_name') + award_capacity = b.request.params.get('award_capacity') + if None in (name, award_capacity): + b.abort(403) + return lottery.add_awards({'award_name': name, 'award_capacity': award_capacity}) + + @app.route('/reset') def reset(): return lottery.reset()