Ejemplo n.º 1
0
def DelRoute():
    result = RouteModel().DelRouteRequest(
        route_id=request.form.getlist('route_id[]'))

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

    return ResultDeal(data=result)
Ejemplo n.º 2
0
def LockRoute():
    result = RouteModel().LockRouteRequest(
        route_id=request.form.getlist('route_id[]'),
        isLock=True if request.form.get('isLock') == 'true' else False)

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

    return ResultDeal(data=result)
Ejemplo n.º 3
0
def QueryRouteByParam():
    params = {}
    if request.form.get('is_disabled'):
        params['is_disabled'] = True if request.form.get(
            'is_disabled') == 'true' else False
    if request.form.get('name'):
        params['name'] = request.form.get('name')

    result = RouteModel().QueryRouteByParamRequest(params=params)

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

    return ResultDeal(data=result)
Ejemplo n.º 4
0
def ModifyRoute():
    params = request.form
    Bool = ['cache']
    for i in params:
        if i in Bool:
            params[i] = True if params[i] == 'true' else False

    result = RouteModel().ModifyRouteRequest(
        route_id=request.form.get('route_id'), params=params)

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

    return ResultDeal(data=result)
Ejemplo n.º 5
0
def CreateRoute():
    params = {
        'pid': request.form.get('pid', '0'),
        'name': request.form.get('name'),
        'title': request.form.get('title'),
        'path': request.form.get('path'),
        'component': request.form.get('component'),
        'componentPath': request.form.get('componentPath'),
        'cache': True if request.form.get('cache') == 'true' else False
    }

    result = RouteModel().CreateRouteRequest(params)

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

    return ResultDeal(data=result)
Ejemplo n.º 6
0
def LockRoute():
    result = RouteModel().LockRouteRequest(
        route_id=request.form.getlist('route_id'))
    return ResultDeal(data=result)