diff --git a/tools/rankserver/app.py b/tools/rankserver/app.py index 03409c9..4adc2d6 100644 --- a/tools/rankserver/app.py +++ b/tools/rankserver/app.py @@ -21,7 +21,7 @@ import functools CONFIG_DIR = '../config' if f7.isOnlineEnv() else '/var/data/conf_test/game2004api_rankserver/config' RANK_KEY_PREFIX = 'game2004api:' DBNAME_PREFIX = 'gamedb2004_' -IGNORE_GUESET_ACCOUNT = 0 +IGNORE_GUEST_ACCOUNT = 0 def _take_pass(elem): return elem[3] @@ -139,7 +139,8 @@ def fullUpdateRank(): for row in cursor: has_data = True last_idx = max(row[8], last_idx) - if IGNORE_GUESET_ACCOUNT and (row[1] == '游客' or row[1] == '极乐玩家'): + user_name = str(row[1], encoding='utf8') + if IGNORE_GUEST_ACCOUNT and (user_name == '游客' or user_name == '极乐玩家'): continue #更新击杀榜 channel = f7.getChannelByAccountId(row[0]) @@ -207,7 +208,8 @@ def incrementUpdateRank(): has_data = True channel = f7.getChannelByAccountId(row[0]) last_idx = max(row[8], last_idx) - if IGNORE_GUESET_ACCOUNT and (row[1] == '游客' or row[1] == '极乐玩家'): + user_name = str(row[1], encoding='utf8') + if IGNORE_GUEST_ACCOUNT and (user_name == '游客' or user_name == '极乐玩家'): continue if checkchannel(channel): #更新击杀榜 @@ -247,16 +249,16 @@ def _incrementUpdateRank(rushtime): lambda : _incrementUpdateRank(rushtime)) f7.app.createAsyncTask(done_callback, incrementUpdateRank, ()) +conf = json.loads(open(CONFIG_DIR + '/rankserver.json', 'r').read()) +RANK_KEY_PREFIX = conf.get('key_prefix', RANK_KEY_PREFIX) +DBNAME_PREFIX = conf.get('dbname_prefix', DBNAME_PREFIX) +IGNORE_GUEST_ACCOUNT = conf.get('ignore_guest_account', IGNORE_GUEST_ACCOUNT) + if __name__ == "__main__": q7.xPrint('pid %d' % os.getpid()) f7.app.init('/data/logs/game2004_rankserver/logs') f7.udplog.info('rankserver start pid:' + str(os.getpid())) - conf = json.loads(open(CONFIG_DIR + '/rankserver.json', 'r').read()) - RANK_KEY_PREFIX = conf.get('key_prefix', RANK_KEY_PREFIX) - DBNAME_PREFIX = conf.get('dbname_prefix', DBNAME_PREFIX) - IGNORE_GUESET_ACCOUNT = conf.get('ignore_guest_account', IGNORE_GUESET_ACCOUNT) - conf['rushtime'] = 300 f7.timer.callLater(conf['rushtime'], lambda : _incrementUpdateRank(conf['rushtime']))