From 481bb278dcfc15367f6b3d98bf63ed2fe2eb1da7 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 27 Oct 2020 15:17:09 +0800 Subject: [PATCH] 1 --- tools/rankserver/app.py | 63 +++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/tools/rankserver/app.py b/tools/rankserver/app.py index 5fb433b..c3ee812 100644 --- a/tools/rankserver/app.py +++ b/tools/rankserver/app.py @@ -37,6 +37,11 @@ def getRedisConf(): redis_conf = json.loads(open(CONFIG_DIR + '/rankserver.redis.cluster.json', 'r').read()) return redis_conf; +def checkchannel(channel): + if channel == 6006: + return false + else: + return true def info(msg): print(str(datetime.datetime.now()) + '[INFO] ' + msg) @@ -132,19 +137,22 @@ def fullUpdateRank(): has_data = True #更新击杀榜 channel = f7.getChannelByAccountId(row[0]) - if channel not in kill_hash: - kill_hash[channel] = [] - _refreshData(row, kill_hash[channel], take_kills) + if checkchannel(channel) == true: + if channel not in kill_hash: + kill_hash[channel] = [] + _refreshData(row, kill_hash[channel], take_kills) #更新胜场榜 channel = f7.getChannelByAccountId(row[0]) - if channel not in win_hash: - win_hash[channel] = [] - _refreshData(row, win_hash[channel], take_game_times) + if checkchannel(channel) == true: + if channel not in win_hash: + win_hash[channel] = [] + _refreshData(row, win_hash[channel], take_game_times) #更新积分榜 channel = f7.getChannelByAccountId(row[0]) - if channel not in integral_hash: - integral_hash[channel] = [] - _refreshData(row, integral_hash[channel], take_integral_times) + if checkchannel(channel) == true: + if channel not in integral_hash: + integral_hash[channel] = [] + _refreshData(row, integral_hash[channel], take_integral_times) last_idx = max(row[8], last_idx) time.sleep(0.001); if not has_data: @@ -193,24 +201,25 @@ def incrementUpdateRank(): for row in cursor: has_data = True channel = f7.getChannelByAccountId(row[0]) - #更新击杀榜 - if channel not in kill_hash: - kill_list = r.get('game2004api:kill_rank_' + channel) - kill_hash[channel] = [] if not kill_list else json.loads(kill_list) - _delRepeatData(row, kill_hash[channel]) - _refreshData(row, kill_hash[channel], take_kills) - #更新胜场榜 - if channel not in win_hash: - win_list = r.get('game2004api:win_rank_' + channel) - win_hash[channel] = [] if not win_list else json.loads(win_list) - _delRepeatData(row, win_hash[channel]) - _refreshData(row, win_hash[channel], take_game_times) - #更新积分榜 - if channel not in integral_hash: - integral_list = r.get('game2004api:integral_rank_' + channel) - integral_hash[channel] = [] if not integral_list else json.loads(integral_list) - _delRepeatData(row, integral_hash[channel]) - _refreshData(row, integral_hash[channel], take_integral_times) + if checkchannel(channel) == true: + #更新击杀榜 + if channel not in kill_hash: + kill_list = r.get('game2004api:kill_rank_' + channel) + kill_hash[channel] = [] if not kill_list else json.loads(kill_list) + _delRepeatData(row, kill_hash[channel]) + _refreshData(row, kill_hash[channel], take_kills) + #更新胜场榜 + if channel not in win_hash: + win_list = r.get('game2004api:win_rank_' + channel) + win_hash[channel] = [] if not win_list else json.loads(win_list) + _delRepeatData(row, win_hash[channel]) + _refreshData(row, win_hash[channel], take_game_times) + #更新积分榜 + if channel not in integral_hash: + integral_list = r.get('game2004api:integral_rank_' + channel) + integral_hash[channel] = [] if not integral_list else json.loads(integral_list) + _delRepeatData(row, integral_hash[channel]) + _refreshData(row, integral_hash[channel], take_integral_times) last_idx = max(row[8], last_idx) time.sleep(0.001); if not has_data: