()
return jsonify({'data': end_data, 'total': total, 'status': 1})
查找配置
查找配置
查找配置
def find_config():
    """ 查找配置 """
    data = request.json
    project_id = data.get('projectId')
    config_name = data.get('configName')
    page = data.get('page') if data.get('page') else 1
    per_page = data.get('sizePage') if data.get('sizePage') else 10
    if not project_id:
        return jsonify({'msg': '请先创建属于自己的项目', 'status': 0})

    if config_name:
        _data = Config.query.filter_by(project_id=project_id).filter(Config.name.like('%{}%'.format(config_name)))
        if not _data:
            return jsonify({'msg': '没有该配置', 'status': 0})
    else:
        _data = Config.query.filter_by(project_id=project_id)
    pagination = _data.order_by(Config.num.asc()).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, 'func_address': c.func_address} for c in items]
    return jsonify({'data': end_data, 'total': total, 'status': 1})
def find_config ( ) : data = request . json project_id = data . get ( 'projectId' ) config_name = data . get ( 'configName' ) page = data . get ( 'page' ) if data . get ( 'page' ) else 1 per_page = data . get ( 'sizePage' ) if data . get ( 'sizePage' ) else 10 if not project_id : return jsonify ( { 'msg' : '请先创建属于自己的项目', 'status': 0}) if config_name : _data = Config . query . filter_by ( project_id = project_id ) . filter ( Config . name . like ( '%{}%' . format ( config_name ) ) ) if not _data : return jsonify ( { 'msg' : '没有该配置', 'status' : 0}) else : _data = Config . query . filter_by ( project_id = project_id ) pagination = _data . order_by ( Config . num . asc ( ) ) . 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 , 'func_address' : c . func_address } for c in items ] return jsonify ( { 'data' : end_data , 'total' : total , 'status' : 1 } )