From f8ee128bfd1a2d9ab71d8b9c4e7aee340229ae85 Mon Sep 17 00:00:00 2001 From: pengtao Date: Tue, 16 Jul 2019 17:00:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=8E=AF=E5=A2=83=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ad_interface_tornado.py | 2 +- config.py | 2 ++ server.py | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ad_interface_tornado.py b/ad_interface_tornado.py index 2db0630..c0f1078 100644 --- a/ad_interface_tornado.py +++ b/ad_interface_tornado.py @@ -112,7 +112,7 @@ class DispatchHandler(tornado.web.RequestHandler): if adid: key = f"ad::{adid}::num" - my_redis.incr(key) + my_redis.incr(key, amount=1) self.write({'errcode': 0, "errmsg": '', "message": f"{adid} incr success!"}) diff --git a/config.py b/config.py index e72867a..d6926b9 100644 --- a/config.py +++ b/config.py @@ -10,6 +10,8 @@ if ad_env == 'prod': elif ad_env == 'dev': redis_company_config = {'host': '192.168.100.20', 'port': 6379, 'db': 2, 'passwd': ''} mysql_promotion_config = {'user': 'miles', 'pswd': 'aspect', 'host': '192.168.100.30', 'db': 'test'} +else: + raise Exception("GET config with mysql/redis failed!") expire_time = 7200 diff --git a/server.py b/server.py index cbf416b..97fa8c7 100644 --- a/server.py +++ b/server.py @@ -17,9 +17,9 @@ app = Flask(__name__) api = Api(app) # 设置路由 -api.add_resource(Company, '/company') -api.add_resource(Location, '/location') -api.add_resource(Ad, '/ad') +api.add_resource(Company, '/interface/company') +api.add_resource(Location, '/interface/location') +api.add_resource(Ad, '/interface/ad') if __name__ == '__main__': app.run(host='0.0.0.0', debug=True, port=5015)