示例#1
0
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})
示例#2
0
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')})
示例#3
0
def update():
    db = DB()
    update_data = json.loads(request.form.get('data'))
    status = db.update_article(update_data)
    db.close()
    return jsonify({"code": status})
示例#4
0
def insert():
    db = DB()
    insert_data = json.loads(request.form.get('data'))
    status = db.insert_article(insert_data)
    db.close()
    return jsonify({"code": status})