Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -346,11 +346,13 @@ def write_or():
|
|
346 |
|
347 |
|
348 |
|
349 |
-
|
|
|
|
|
350 |
@app.route('/bonus_new', methods=['GET'])
|
351 |
def shop_bonus_new():
|
352 |
try:
|
353 |
-
logging.debug("Starting
|
354 |
api_sys_control = request.args.get('api_sys')
|
355 |
|
356 |
if api_sys_control != api_key_sys:
|
@@ -363,7 +365,6 @@ def shop_bonus_new():
|
|
363 |
bonus = request.args.get('bonus', '')
|
364 |
status = request.args.get('status', '')
|
365 |
del_flag = request.args.get('del', '')
|
366 |
-
|
367 |
|
368 |
if not email or not phone:
|
369 |
logging.error("Email and phone are required")
|
@@ -385,7 +386,7 @@ def shop_bonus_new():
|
|
385 |
bonus_st_data = {}
|
386 |
|
387 |
if del_flag == '1':
|
388 |
-
if
|
389 |
del bonus_st_data[bonus]
|
390 |
elif bonus and status:
|
391 |
bonus_st_data[bonus] = status
|
@@ -397,8 +398,8 @@ def shop_bonus_new():
|
|
397 |
msk_now = utc_now.replace(tzinfo=pytz.utc).astimezone(msk_tz)
|
398 |
data_on = msk_now.strftime('%Y-%m-%d %H:%M:%S')
|
399 |
|
400 |
-
columns_to_update = ['name', 'phone', 'email', 'pr1', '
|
401 |
-
values_to_update = [name, phone, email, bonus_st_json,
|
402 |
|
403 |
if result:
|
404 |
set_clause = ', '.join([f"{col} = ?" for col in columns_to_update])
|
@@ -414,7 +415,7 @@ def shop_bonus_new():
|
|
414 |
|
415 |
conn.close()
|
416 |
|
417 |
-
return json.dumps(
|
418 |
|
419 |
except Exception as e:
|
420 |
logging.error(f"An error occurred: {str(e)}")
|
|
|
346 |
|
347 |
|
348 |
|
349 |
+
|
350 |
+
|
351 |
+
# Работа с бонусами из сайта без VK_ID
|
352 |
@app.route('/bonus_new', methods=['GET'])
|
353 |
def shop_bonus_new():
|
354 |
try:
|
355 |
+
logging.debug("Starting shop_bonus_new")
|
356 |
api_sys_control = request.args.get('api_sys')
|
357 |
|
358 |
if api_sys_control != api_key_sys:
|
|
|
365 |
bonus = request.args.get('bonus', '')
|
366 |
status = request.args.get('status', '')
|
367 |
del_flag = request.args.get('del', '')
|
|
|
368 |
|
369 |
if not email or not phone:
|
370 |
logging.error("Email and phone are required")
|
|
|
386 |
bonus_st_data = {}
|
387 |
|
388 |
if del_flag == '1':
|
389 |
+
if bonus in bonus_st_data:
|
390 |
del bonus_st_data[bonus]
|
391 |
elif bonus and status:
|
392 |
bonus_st_data[bonus] = status
|
|
|
398 |
msk_now = utc_now.replace(tzinfo=pytz.utc).astimezone(msk_tz)
|
399 |
data_on = msk_now.strftime('%Y-%m-%d %H:%M:%S')
|
400 |
|
401 |
+
columns_to_update = ['name', 'phone', 'email', 'pr1', 'data_on']
|
402 |
+
values_to_update = [name, phone, email, bonus_st_json, data_on]
|
403 |
|
404 |
if result:
|
405 |
set_clause = ', '.join([f"{col} = ?" for col in columns_to_update])
|
|
|
415 |
|
416 |
conn.close()
|
417 |
|
418 |
+
return json.dumps(bonus_st_data), 200
|
419 |
|
420 |
except Exception as e:
|
421 |
logging.error(f"An error occurred: {str(e)}")
|