Example #1
0
def CreateInterface():
    result = InterfaceModel().CreateInterfaceRequest(request.form)

    if type(result).__name__ == 'str':
        return ResultDeal(msg=result, code=-1)

    return ResultDeal(data=result)
Example #2
0
def ModifyInterface():
    result = InterfaceModel().ModifyInterfaceRequest(
        request.form.get('interface_id'), request.form)

    if type(result).__name__ == 'str':
        return ResultDeal(msg=result, code=-1)

    return ResultDeal(data=result)
Example #3
0
def DelInterface():
    result = InterfaceModel().DelInterfaceRequest(
        request.form.getlist('interface_id[]'))

    if type(result).__name__ == 'str':
        return ResultDeal(msg=result, code=-1)

    return ResultDeal(data=result)
Example #4
0
def LockInterface():
    result = InterfaceModel().LockInterfaceRequest(
        interface_id=request.form.getlist('interface_id[]'),
        is_disabled=True
        if request.form.get('is_disabled') == 'true' else False)

    if type(result).__name__ == 'str':
        return ResultDeal(msg=result, code=-1)

    return ResultDeal(data=result)
Example #5
0
def QueryInterfaceByParam():
    result = InterfaceModel().QueryInterfaceByParamRequest(
        params=request.form,
        page=int(request.form.get('page')),
        page_size=int(request.form.get('page_size')),
        order_by=request.form.get('order_by'))

    if type(result).__name__ == 'str':
        return ResultDeal(msg=result, code=-1)

    return ResultDeal(data=result)
Example #6
0
def ModifyInterface():
    params = {
        'name': request.form.get('name'),
        'path': request.form.get('path'),
        'method': request.form.get('method'),
        'description': request.form.get('description'),
        'menu_id': request.form.get('menu_id'),
        'mark': request.form.get('mark')
    }

    result = InterfaceModel().ModifyInterfaceRequest(
        interface_id=request.form.get('interface_id'), params=params)

    if type(result).__name__ == 'str':
        return ResultDeal(msg=result, code=-1)

    return ResultDeal(data=result)
Example #7
0
def CreateInterface():
    params = {
        'name': request.form.get('name'),
        'path': request.form.get('path'),
        'method': request.form.get('method'),
        'description': request.form.get('description'),
        'menu_id': request.form.get('menu_id'),
        'mark': request.form.get('mark'),
        'not_allow': True if request.form.get('not_allow') == 'true' else False
    }

    result = InterfaceModel().CreateInterfaceRequest(params)

    if type(result).__name__ == 'str':
        return ResultDeal(msg=result, code=-1)

    return ResultDeal(data=result)
Example #8
0
def ModifyInterface():
    params = {
        'name': request.form.get('name'),
        'path': request.form.get('path'),
        'method': request.form.get('method'),
        'description': request.form.get('description'),
        'menus': request.form.getlist('menus[]'),
        'mark': request.form.get('mark'),
        'is_disabled':
        True if request.form.get('is_disabled') == 'true' else False
    }

    result = InterfaceModel().ModifyInterfaceRequest(
        interface_id=request.form.get('interface_id'), params=params)

    if type(result).__name__ == 'str':
        return ResultDeal(msg=result, code=-1)

    return ResultDeal(data=result)
Example #9
0
def QueryInterfaceByParam():
    params = {}
    if request.form.get('is_disabled'):
        params['is_disabled'] = True if request.form.get(
            'is_disabled') == 'true' else False
    Ary = ['name', 'method']
    for i in Ary:
        if request.form.get(i):
            params[i] = request.form.get(i)

    result = InterfaceModel().QueryInterfaceByParamRequest(
        params=params,
        page=int(request.form.get('page')),
        page_size=int(request.form.get('page_size')),
        order_by=request.form.get('order_by', None))

    if type(result).__name__ == 'str':
        return ResultDeal(msg=result, code=-1)

    return ResultDeal(data=result)