fix some error

This commit is contained in:
pengtao 2019-07-16 15:04:23 +08:00
parent 5bb7120829
commit d6771da497
2 changed files with 13 additions and 8 deletions

View File

@ -22,6 +22,8 @@ http://192.168.100.20:8888/company
##### 请求示范 ##### 请求示范
http://154.8.214.202:5015/company
http://192.168.100.20:8888/company?status=0 http://192.168.100.20:8888/company?status=0
##### 请求参数说明 ##### 请求参数说明

View File

@ -133,8 +133,12 @@ class DispatchHandler(tornado.web.RequestHandler):
if gameid and locationid: if gameid and locationid:
key = f"{gameid}::{locationid}" key = f"{gameid}::{locationid}"
ids = my_redis.smembers(key) ids = my_redis.smembers(key)
info = [] info = []
if not ids:
result = {'errcode': 0, "errmsg": '', "message": {"totoal": len(info), "result": info}}
else:
try: try:
for id in ids: for id in ids:
temp = my_redis.hgetall(f"{id}::info") temp = my_redis.hgetall(f"{id}::info")
@ -142,7 +146,6 @@ class DispatchHandler(tornado.web.RequestHandler):
result = {'errcode': 0, "errmsg": '', "message": {"totoal": len(info), "result": info}} result = {'errcode': 0, "errmsg": '', "message": {"totoal": len(info), "result": info}}
except Exception as e: except Exception as e:
result = {'errcode': 1, "errmsg": e} result = {'errcode': 1, "errmsg": e}
finally:
self.write(result) self.write(result)
else: else:
result = {'errcode': 2, "errmsg": f"get args failed!"} result = {'errcode': 2, "errmsg": f"get args failed!"}