()
return jsonify({'msg': '删除成功', 'status': 1})
删除用例
删除用例
删除用例
def del_case():
    """ 删除用例 """
    data = request.json
    case_id = data.get('caseId')
    wait_del_case_data = Case.query.filter_by(id=case_id).first()
    if current_user.id != Project.query.filter_by(id=wait_del_case_data.project_id).first().user_id:
        return jsonify({'msg': '不能删除别人项目下的用例', 'status': 0})

    _del_data = CaseData.query.filter_by(case_id=case_id).all()
    if _del_data:
        for d in _del_data:
            db.session.delete(d)
    db.session.delete(wait_del_case_data)
    db.session.commit()
    return jsonify({'msg': '删除成功', 'status': 1})
def del_case ( ) : data = request . json case_id = data . get ( 'caseId' ) wait_del_case_data = Case . query . filter_by ( id = case_id ) . first ( ) if current_user . id != Project . query . filter_by ( id = wait_del_case_data . project_id ) . first ( ) . user_id : return jsonify ( { 'msg' : '不能删除别人项目下的用例', 'status': 0}) _del_data = CaseData . query . filter_by ( case_id = case_id ) . all ( ) if _del_data : for d in _del_data : db . session . delete ( d ) db . session . delete ( wait_del_case_data ) db . session . commit ( ) return jsonify ( { 'msg' : '删除成功', 'statu s : 1})