()
删除报告
删除报告
删除报告
def del_report():
    """ 删除报告 """
    data = request.json
    report_id = data.get('report_id')
    _edit = Report.query.filter_by(id=report_id).first()
    db.session.delete(_edit)
    db.session.commit()
    address = str(report_id) + '.txt'
    if not os.path.exists(REPORT_ADDRESS + address):
        return jsonify({'msg': '删除成功', 'status': 1})
    else:
        os.remove(REPORT_ADDRESS + address)
        return jsonify({'msg': '删除成功', 'status': 1})
def del_report ( ) : data = request . json report_id = data . get ( 'report_id' ) _edit = Report . query . filter_by ( id = report_id ) . first ( ) db . session . delete ( _edit ) db . session . commit ( ) address = str ( report_id ) + '.txt' if not os . path . exists ( REPORT_ADDRESS + address ) : return jsonify ( { 'msg' : '删除成功', 'statu s : 1}) else : os . remove ( REPORT_ADDRESS + address ) return jsonify ( { 'msg' : '删除成功', 'statu s : 1})