任务分发接口优化
This commit is contained in:
parent
7c4811d52c
commit
920208b4bb
17
app.py
17
app.py
|
@ -34,7 +34,6 @@ app.logger.addHandler(handler)
|
|||
app.logger.setLevel(logging.INFO)
|
||||
|
||||
|
||||
# H5 项目接口
|
||||
@app.route('/h5', methods=['GET'])
|
||||
def get_h5_account_info():
|
||||
sql_str = "select account_id,keep_rate,task_total,account_name,is_active, countries, link_url from account_h5_info"
|
||||
|
@ -163,21 +162,12 @@ def get_browser_info():
|
|||
return jsonify({'status': "error", "message": str(e)})
|
||||
|
||||
|
||||
@app.route('/get_account', methods=['GET'])
|
||||
def get_account_id():
|
||||
sql_str = "select account_id from account_h5_info where is_active=1 ORDER BY RAND() LIMIT 1"
|
||||
result = db.execute_query(sql_str, )
|
||||
if result:
|
||||
return jsonify({'accountId': result[0][0]})
|
||||
return jsonify({'status': "error", "message": "<UNK>"})
|
||||
|
||||
|
||||
@app.route('/upload_task_status', methods=['GET'])
|
||||
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))
|
||||
app.logger.info("upload_task_status <UNK>{},{},{}".format(task_status, task_id, account_id))
|
||||
try:
|
||||
sql_str = "UPDATE task_execute_status SET task_status=%s WHERE account_id=%s and task_id=%s"
|
||||
db.execute_update(sql_str, (task_status, account_id, task_id))
|
||||
|
@ -193,9 +183,8 @@ def upload_task_status():
|
|||
|
||||
@app.route('/h5_issue_task', methods=['GET'])
|
||||
def issue_task():
|
||||
account_id = request.args.get('accountId')
|
||||
sql_str = "select account_id,keep_rate,task_total,account_name,is_active,countries,link_url from account_h5_info where account_id=%s and is_active=1"
|
||||
result = db.execute_query(sql_str, (account_id,))
|
||||
sql_str = "select account_id,keep_rate,task_total,account_name,is_active,countries,link_url from account_h5_info where is_active=1 ORDER BY RAND() LIMIT 1"
|
||||
result = db.execute_query(sql_str, )
|
||||
if result:
|
||||
countries = result[0][-2]
|
||||
link_url = result[0][-1]
|
||||
|
|
Loading…
Reference in New Issue