新增账号修改记录

This commit is contained in:
liujianjiang 2025-07-14 18:19:36 +08:00
parent be27217357
commit 7c4811d52c
1 changed files with 14 additions and 3 deletions

17
app.py
View File

@ -73,6 +73,8 @@ def add_h5_user():
db.execute_single(sql_str, (account_id, keep_rate, db.execute_single(sql_str, (account_id, keep_rate,
task_total, account_name, task_total, account_name,
countries, link_url)) countries, link_url))
sql_str = "insert into h5_new_task_record_info(account_id, task_total) values (%s, %s)"
db.execute_single(sql_str, (account_id, task_total))
success = True success = True
return redirect(url_for('get_h5_account_info')) return redirect(url_for('get_h5_account_info'))
except Exception as e: except Exception as e:
@ -106,6 +108,8 @@ def edit_user():
update_time = datetime.now() update_time = datetime.now()
sql_str = "UPDATE account_h5_info set keep_rate=%s, task_total=%s, account_name=%s ,is_active=%s ,countries=%s, link_url=%s,update_time=%s where account_id=%s" sql_str = "UPDATE account_h5_info set keep_rate=%s, task_total=%s, account_name=%s ,is_active=%s ,countries=%s, link_url=%s,update_time=%s where account_id=%s"
db.execute_single(sql_str, (keep_rate, task_total, account_name, is_active, countries, link_url, update_time, account_id)) db.execute_single(sql_str, (keep_rate, task_total, account_name, is_active, countries, link_url, update_time, account_id))
sql_str = "insert into h5_new_task_record_info(account_id, task_total) values (%s, %s)"
db.execute_single(sql_str, (account_id, task_total))
return redirect(url_for('get_h5_account_info')) return redirect(url_for('get_h5_account_info'))
sql_str = "select account_id,keep_rate,task_total,account_name,is_active,countries, link_url from account_h5_info where account_id=%s" sql_str = "select account_id,keep_rate,task_total,account_name,is_active,countries, link_url from account_h5_info where account_id=%s"
result = db.execute_query(sql_str, (account_id,)) result = db.execute_query(sql_str, (account_id,))
@ -170,11 +174,19 @@ def get_account_id():
@app.route('/upload_task_status', methods=['GET']) @app.route('/upload_task_status', methods=['GET'])
def upload_task_status(): def upload_task_status():
account_id = request.args.get('accountId')
task_id = request.args.get('taskId')
task_status = request.args.get("taskStatus")
app.logger.info("upload_task_status <UNK>{},{},{}".format(task_status,task_id,account_id))
try: try:
sql_str = "UPDATE task_execute_status SET task_status = %s, WHERE account_id = %s and task_id=%s" sql_str = "UPDATE task_execute_status SET task_status=%s WHERE account_id=%s and task_id=%s"
db.execute_update(sql_str, (request.args.get("task_status"), request.args.get('account_id'), request.args.get('task_id'))) db.execute_update(sql_str, (task_status, account_id, task_id))
return jsonify({'status': 'ok'}) return jsonify({'status': 'ok'})
except Exception as e: except Exception as e:
if account_id in str(e):
sql_str = "insert into task_execute_status(account_id,task_id,task_status) values(%s,%s,%s)"
db.execute_single(sql_str, (account_id, task_id, task_status))
return jsonify({'status': 'ok'})
app.logger.info("<UNK>{}".format(str(e))) app.logger.info("<UNK>{}".format(str(e)))
return jsonify({'status': "error", "message": str(e)}) return jsonify({'status': "error", "message": str(e)})
@ -243,7 +255,6 @@ def upload_file():
app.logger.info("文件:{}已保持".format(file_name)) app.logger.info("文件:{}已保持".format(file_name))
return jsonify({'message': 'File uploaded successfully', 'path': file_path}) return jsonify({'message': 'File uploaded successfully', 'path': file_path})
@app.route('/', methods=['get']) @app.route('/', methods=['get'])
def test_post(): def test_post():
return jsonify({"key": "value"}) return jsonify({"key": "value"})