From ddea0b15960b048eb47efc223a0459dd59ef33d5 Mon Sep 17 00:00:00 2001 From: UnitedAirforce Date: Wed, 29 Jan 2025 06:50:25 +0800 Subject: [PATCH] bug fix --- 7001.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/7001.py b/7001.py index 1ec0070..ae79cfa 100644 --- a/7001.py +++ b/7001.py @@ -113,8 +113,12 @@ def create_table(): timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP, my_stage TEXT, my_avatar TEXT, - items TEXT, - day INT + item TEXT, + day INT, + coin INT, + lvl INT, + title INT, + avatar INT );""") cursor.execute( """ @@ -550,7 +554,7 @@ def bonus(): time = datetime.now() formatted_time = time.strftime("%Y-%m-%d %H:%M:%S") - if row: + if row is not None: current_day, last_timestamp = row last_date = datetime.strptime(last_timestamp, "%Y-%m-%d %H:%M:%S") @@ -573,10 +577,11 @@ def bonus(): # return 1 obj else: # No row exists; create a new one + print("bonus-add profile") cursor.execute(""" - INSERT INTO daily_reward (device_id, day, timestamp, my_avatar, my_stage, coin, item) - VALUES (?, ?, ?, ?, ?, ?) - """, (device_id, 1, formatted_time, json.dumps(start_avatars), json.dumps(start_stages), 10, "[]")) + INSERT INTO daily_reward (device_id, day, timestamp, my_avatar, my_stage, coin, item, lvl, title, avatar) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + """, (device_id, 1, formatted_time, json.dumps(start_avatars), json.dumps(start_stages), 10, "[]", 1, 1, 1)) xml_response = "0" # return 0 obj