1
This commit is contained in:
parent
77f3a4cbca
commit
593047e500
@ -61,6 +61,14 @@ def getDaySeconds(time_val, incdays):
|
|||||||
dayseconds = int((time_val + time_zone * 3600)/3600/24 + incdays) * 3600 * 24 - 3600 * time_zone;
|
dayseconds = int((time_val + time_zone * 3600)/3600/24 + incdays) * 3600 * 24 - 3600 * time_zone;
|
||||||
return dayseconds
|
return dayseconds
|
||||||
|
|
||||||
|
#数据去重
|
||||||
|
def delRepeatData(row, data_list):
|
||||||
|
i = 0
|
||||||
|
for data in data_list:
|
||||||
|
if (data[0] == row[0]):
|
||||||
|
del data_list[i]
|
||||||
|
i = i + 1
|
||||||
|
|
||||||
#刷新数据
|
#刷新数据
|
||||||
def refreshData(row, data_list, data_info):
|
def refreshData(row, data_list, data_info):
|
||||||
key_info = data_info
|
key_info = data_info
|
||||||
@ -137,6 +145,7 @@ def dayReadMysqlData(rushtime):
|
|||||||
|
|
||||||
has_data = False
|
has_data = False
|
||||||
for row in cursor:
|
for row in cursor:
|
||||||
|
#更新击杀榜
|
||||||
refreshData(row, kill_list, take_kills)
|
refreshData(row, kill_list, take_kills)
|
||||||
#更新生存榜
|
#更新生存榜
|
||||||
refreshData(row, alive_list, take_alive_time)
|
refreshData(row, alive_list, take_alive_time)
|
||||||
@ -217,14 +226,19 @@ def readMysqlData(rushtime):
|
|||||||
has_data = False
|
has_data = False
|
||||||
for row in cursor:
|
for row in cursor:
|
||||||
#更新击杀榜
|
#更新击杀榜
|
||||||
|
delRepeatData(row, kill_list)
|
||||||
refreshData(row, kill_list, take_kills)
|
refreshData(row, kill_list, take_kills)
|
||||||
#更新生存榜
|
#更新生存榜
|
||||||
|
delRepeatData(row, alive_list)
|
||||||
refreshData(row, alive_list, take_alive_time)
|
refreshData(row, alive_list, take_alive_time)
|
||||||
#更新伤害榜
|
#更新伤害榜
|
||||||
|
delRepeatData(row, harm_list)
|
||||||
refreshData(row, harm_list, take_harms)
|
refreshData(row, harm_list, take_harms)
|
||||||
#更新胜率榜
|
#更新胜率榜
|
||||||
|
delRepeatData(row, rate_list)
|
||||||
refreshData(row, rate_list, take_win_times)
|
refreshData(row, rate_list, take_win_times)
|
||||||
#更新胜场榜
|
#更新胜场榜
|
||||||
|
delRepeatData(row, win_list)
|
||||||
refreshData(row, win_list, take_game_times)
|
refreshData(row, win_list, take_game_times)
|
||||||
temp_idx = int(row[8])
|
temp_idx = int(row[8])
|
||||||
if (temp_idx > last_idx) :
|
if (temp_idx > last_idx) :
|
||||||
@ -258,7 +272,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
app = make_app()
|
app = make_app()
|
||||||
app.listen(conf['listen_port'])
|
app.listen(conf['listen_port'])
|
||||||
conf['rushtime'] = 300
|
conf['rushtime'] = 5
|
||||||
tornado.ioloop.IOLoop.current().call_later(conf['rushtime'],
|
tornado.ioloop.IOLoop.current().call_later(conf['rushtime'],
|
||||||
lambda : readMysqlData(conf['rushtime'])
|
lambda : readMysqlData(conf['rushtime'])
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user