diff --git a/scripts/md_csv/test_gamelog.py b/scripts/md_csv/test_gamelog.py index 1c31c55..c2d31a7 100644 --- a/scripts/md_csv/test_gamelog.py +++ b/scripts/md_csv/test_gamelog.py @@ -5,6 +5,7 @@ import time import json import pprint import hashlib +import random import http.client import urllib.parse @@ -36,6 +37,51 @@ def createSessionId(accountid, register_time, session_key): md5Str(accountid + 'f3a6a9a5-217a-4079-ab99-b5d69b8212be' + register_time + nowtime) + '_' + \ md5Str('f3a6a9a5-217a-4079-ab99-b5d69b8212be' + accountid + session_key) +def testReportUser(): + for key in range(1, 1000): + accountid = str(int(time.time())) + url = '/webapp/index.php?c=GameLog&a=reportUser&' + '&'.join([ + 'gameid=' + '1004', + 'channel=' + '6000', + 'account_id=' + accountid, + 'session_id=' + createSessionId(accountid, accountid, 'abdef'), + 'access_token=' + '', + 'from_appid=' + 'from_appid', + ]) + post_body = { + 'set': {'field' + str(i) : i for i in range(1, 40)}, + 'set_once': {'once' + str(i) : i for i in range(1, 40)}, + 'add': {'add' + str(i) : i for i in range(1, 40)}, + } + + conn = http.client.HTTPConnection(GAMELOG_HOST) + conn.request("POST", url, json.dumps(post_body)) + data = conn.getresponse() +# print(data.read().decode('utf-8')) + print(json.loads(data.read().decode('utf-8'))) + +def testReportStat(): + for key in range(1, 1000): + accountid = str(int(time.time())) + url = '/webapp/index.php?c=GameLog&a=reportStat&' + '&'.join([ + 'gameid=' + '1004', + 'channel=' + '6000', + 'account_id=' + accountid, + 'session_id=' + createSessionId(accountid, accountid, 'abdef'), + 'access_token=' + '', + 'from_appid=' + 'from_appid', + 'stat_type=' + 'y', + ]) + post_body = { + 'add': {'add' + str(i) : i for i in range(1, 40)}, + } + + conn = http.client.HTTPConnection(GAMELOG_HOST) + conn.request("POST", url, json.dumps(post_body)) + data = conn.getresponse() +# print(data.read().decode('utf-8')) + print(json.loads(data.read().decode('utf-8'))) + def testReportLog(): for key in log_dict['__keys__']: node = log_dict[key] @@ -59,7 +105,9 @@ def testReportLog(): conn = http.client.HTTPConnection(GAMELOG_HOST) conn.request("POST", url, json.dumps(post_body)) data = conn.getresponse() - print(data.read().decode('utf-8')) -# print(json.loads(data.read().decode('utf-8'))) +# print(data.read().decode('utf-8')) + print(json.loads(data.read().decode('utf-8'))) -testReportLog() +#testReportLog() +#testReportUser() +testReportStat()