diff --git a/handler/__pycache__/company.cpython-36.pyc b/handler/__pycache__/company.cpython-36.pyc index 4ca6ee1..a10b012 100644 Binary files a/handler/__pycache__/company.cpython-36.pyc and b/handler/__pycache__/company.cpython-36.pyc differ diff --git a/handler/__pycache__/location.cpython-36.pyc b/handler/__pycache__/location.cpython-36.pyc new file mode 100644 index 0000000..e8b2f4a Binary files /dev/null and b/handler/__pycache__/location.cpython-36.pyc differ diff --git a/handler/location.py b/handler/location.py index 1fae35f..28d1cd3 100644 --- a/handler/location.py +++ b/handler/location.py @@ -24,7 +24,7 @@ class Location(Resource): self.args = parser.parse_args() def get(self): - sql = f"select id,gameid,area,type from localtion where in_used=1" + sql = f"select id,gameid,area,type from location where in_used=1;" try: data = mydb.query(sql) except Exception: @@ -39,6 +39,7 @@ class Location(Resource): localtion['id'], localtion['gameid'], localtion['area'], localtion['type'] = line all_data.append(localtion) del localtion + return jsonify({'code': 200,'message': all_data}) else: log.error(f"{data} not found in mysql !") return jsonify({'code': 404}) @@ -91,6 +92,8 @@ class Location(Resource): def delete(self): id = self.args['id'] + if not id: + return jsonify({'code':500,'message':'id not found'}) try: del_sql = f'delete from location where id={id};' mydb.query(del_sql)