From 3dca880d47d01084127f2edd0f51f4cadc4fd4e1 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 22 Nov 2018 15:43:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84convert=5Fnewjosn.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/md_csv/convert_newjson.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/md_csv/convert_newjson.py b/scripts/md_csv/convert_newjson.py index 538f377..38f9803 100644 --- a/scripts/md_csv/convert_newjson.py +++ b/scripts/md_csv/convert_newjson.py @@ -21,7 +21,10 @@ def convertOldEvent(oldJson): event_name = oldJson['#event_name'] strings = event_name.split('_') assert(len(strings) == 3) - node = log_dict[strings[1] + '-' + strings[2]] + finally_event_name = strings[1] + '-' + strings[2] + if not (finally_event_name in log_dict): + return + node = log_dict[finally_event_name] assert(node != None) properties = oldJson['properties'] for i in range(1, 20): @@ -72,10 +75,12 @@ def convert_newjson(gameid): new_file.write(json.dumps(jsonObj) + '\n') elif jsonObj['#type'] == 'user_add': properties = jsonObj['properties'] - del properties['account_id'] + if 'account_id' in properties: + del properties['account_id'] new_file.write(json.dumps(jsonObj) + '\n') else: new_file.write(line + '\n') +convert_newjson('1003') convert_newjson('1004') convert_newjson('1011')