()
return jsonify({'msg': '删除成功', 'status': 1})
删除接口信息
删除接口信息
删除接口信息
def del_api_msg():
    """ 删除接口信息 """
    data = request.json
    api_msg_id = data.get('apiMsgId')
    _data = ApiMsg.query.filter_by(id=api_msg_id).first()

    project_id = Module.query.filter_by(id=_data.module_id).first().project_id
    if current_user.id != Project.query.filter_by(id=project_id).first().user_id:
        return jsonify({'msg': '不能删除别人项目下的接口', 'status': 0})

    # 同步删除接口信息下对应用例下的接口步骤信息
    for d in CaseData.query.filter_by(api_msg_id=api_msg_id).all():
        db.session.delete(d)

    db.session.delete(_data)
    db.session.commit()
    return jsonify({'msg': '删除成功', 'status': 1})
def del_api_msg ( ) : data = request . json api_msg_id = data . get ( 'apiMsgId' ) _data = ApiMsg . query . filter_by ( id = api_msg_id ) . first ( ) project_id = Module . query . filter_by ( id = _data . module_id ) . first ( ) . project_id if current_user . id != Project . query . filter_by ( id = project_id ) . first ( ) . user_id : return jsonify ( { 'msg' : '不能删除别人项目下的接口', 'status': 0}) # 同步删除接口信息下对应用例下的接口步骤信息 for d in CaseData . query . filter_by ( api_msg_id = api_msg_id ) . all ( ) : db . session . delete ( d ) db . session . delete ( _data ) db . session . commit ( ) return jsonify ( { 'msg' : '删除成功', 'statu s : 1})