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)