fix location
This commit is contained in:
parent
ac8aa11068
commit
2b28947bea
Binary file not shown.
BIN
handler/__pycache__/location.cpython-36.pyc
Normal file
BIN
handler/__pycache__/location.cpython-36.pyc
Normal file
Binary file not shown.
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user