|
@@ -0,0 +1,51 @@
|
|
|
|
|
+
|
|
|
|
|
+#======================= test =========================#
|
|
|
|
|
+
|
|
|
|
|
+import requests
|
|
|
|
|
+import json
|
|
|
|
|
+
|
|
|
|
|
+user_id=715
|
|
|
|
|
+game_id=141
|
|
|
|
|
+url = "http://onlyellow.cstor.cn:18888/launch_refund"
|
|
|
|
|
+
|
|
|
|
|
+server_logs = "[Server] 2020/06/16 09:52:56 Refund ID: 22f6f61f-d573-4eff-963a-708983317057"
|
|
|
|
|
+sp_log = server_logs.split(' ', -1)
|
|
|
|
|
+refund_id = sp_log[5]
|
|
|
|
|
+# print(refund_id)
|
|
|
|
|
+data = json.dumps({"user_id":user_id, "game_id":game_id, "refund_id":refund_id})
|
|
|
|
|
+response = requests.post(url=url, data=data)
|
|
|
|
|
+print(response)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+data_a = {"user_id":user_id, "game_id":game_id, "refund_id":refund_id}
|
|
|
|
|
+print(type(data_a))
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+#======================= comp =========================#
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+import json
|
|
|
|
|
+import urllib.request
|
|
|
|
|
+import urllib.parse
|
|
|
|
|
+import base64
|
|
|
|
|
+import gzip
|
|
|
|
|
+# import requests
|
|
|
|
|
+
|
|
|
|
|
+def lambda_handler(event, context):
|
|
|
|
|
+
|
|
|
|
|
+ user_id=**
|
|
|
|
|
+ game_id=**
|
|
|
|
|
+ url = "http://onlyellow.cstor.cn:18888/launch_refund"
|
|
|
|
|
+
|
|
|
|
|
+ de_content = base64.b64decode(event['awslogs']['data'])
|
|
|
|
|
+ ret = json.loads(gzip.decompress(de_content).decode('utf8'))
|
|
|
|
|
+ log_msg = ret['logEvents'][0]['message']
|
|
|
|
|
+ tup_log = log_msg.split(' ', -1)
|
|
|
|
|
+ refund_id = tup_log[5]
|
|
|
|
|
+ # post
|
|
|
|
|
+ data = json.dumps({"user_id":user_id, "game_id":game_id, "refund_id":refund_id})
|
|
|
|
|
+ last_data=bytes(data,encoding='utf-8')
|
|
|
|
|
+ headers = {"Content-Type":'application/json'}
|
|
|
|
|
+ req = urllib.request.Request(url=url, headers=headers, data=last_data)
|
|
|
|
|
+ response = urllib.request.urlopen(req)
|
|
|
|
|
+ print(response.read().decode('utf-8'))
|