def delete(): db = DB() delete_data = json.loads(request.form.get('data')) print(delete_data) status = db.delete_article(delete_data) db.close() return jsonify({"code": status})
def query(): db = DB() query_data = json.loads(request.form.get('data')) args = list(query_data.values()) table = db.query_article(*args) db.close() if table.empty: return jsonify({"code": -1}) return jsonify({"code": 0, "data": table.to_html(classes='data')})
def update(): db = DB() update_data = json.loads(request.form.get('data')) status = db.update_article(update_data) db.close() return jsonify({"code": status})
def insert(): db = DB() insert_data = json.loads(request.form.get('data')) status = db.insert_article(insert_data) db.close() return jsonify({"code": status})