()
return jsonify({'data': end_data, 'total': total, 'status': 1, 'all_module': _all_module})
查找接口模块
查找接口模块
查找接口模块
def find_model():
    """ 查找接口模块 """
    data = request.json
    page = data.get('page') if data.get('page') else 1
    per_page = data.get('sizePage') if data.get('sizePage') else 10
    project_id = data.get('projectId')
    if not project_id:
        return jsonify({'msg': '请先创建属于自己的项目', 'status': 0})

    # all_module = Project.get_first(id=project_id).modules
    all_module = Module.query.filter_by(project_id=project_id)
    pagination = all_module.paginate(page, per_page=per_page, error_out=False)
    items = pagination.items
    total = pagination.total
    end_data = [{'name': c.name, 'id': c.id, 'num': c.num} for c in items]

    # 查询出所有的接口模块是为了接口录入的时候可以选所有的模块
    _all_module = [{'name': s.name, 'id': s.id, 'num': s.num} for s in all_module.all()]
    return jsonify({'data': end_data, 'total': total, 'status': 1, 'all_module': _all_module})
def find_model ( ) : data = request . json page = data . get ( 'page' ) if data . get ( 'page' ) else 1 per_page = data . get ( 'sizePage' ) if data . get ( 'sizePage' ) else 10 project_id = data . get ( 'projectId' ) if not project_id : return jsonify ( { 'msg' : '请先创建属于自己的项目', 'status': 0}) # all_module = Project.get_first(id=project_id).modules all_module = Module . query . filter_by ( project_id = project_id ) pagination = all_module . paginate ( page , per_page = per_page , error_out = False ) items = pagination . items total = pagination . total end_data = [ { 'name' : c . name , 'id' : c . id , 'num' : c . num } for c in items ] # 查询出所有的接口模块是为了接口录入的时候可以选所有的模块 _all_module = [ { 'name' : s . name , 'id' : s . id , 'num' : s . num } for s in all_module . all ( ) ] return jsonify ( { 'data' : end_data , 'total' : total , 'status' : 1 , 'all_module' : _all_module } )