Exemplo n.º 1
0
def GetMenuToInterface(menu_id):
    result = MenuModel().GetMenuToInterfaceRequest(menu_id=menu_id)

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

    return ResultDeal(data=result)
Exemplo n.º 2
0
def DelMenu():
    result = MenuModel().DelMenuRequest(menu_id=request.form.get('menu_id'))

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

    return ResultDeal(data=result)
Exemplo n.º 3
0
def LockMenu():
    result = MenuModel().LockMenuRequest(
        menu_id=request.form.get('menu_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)
Exemplo n.º 4
0
def QueryMenuByParam():
    params = {}
    if request.form.get('isLock'):
        params['isLock'] = True if request.form.get(
            'isLock') == 'true' else False

    result = MenuModel().QueryMenuByParamRequest(params=params)

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

    return ResultDeal(data=result)
Exemplo n.º 5
0
def ModifyMenu():
    params = request.form
    Int = ['sort', 'type']
    for i in params:
        if i in Int:
            params[i] = int(params[i])

    result = MenuModel().ModifyMenuRequest(menu_id=request.form.get('menu_id'), params=params)

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

    return ResultDeal(data=result)
Exemplo n.º 6
0
def CreateMenu():
    params = {
        'parentId': request.form.get('parentId', '0'),
        'title': request.form.get('title'),
        'path': request.form.get('path'),
        'icon': request.form.get('icon'),
        'sort': request.form.get('sort'),
        'type': request.form.get('type', 1)
    }

    result = MenuModel().CreateMenuRequest(params)

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

    return ResultDeal(data=result)
Exemplo n.º 7
0
def ModifyMenu():
    params = {
        'pid': request.form.get('pid', '0'),
        'title': request.form.get('title'),
        'path': request.form.get('path'),
        'icon': request.form.get('icon'),
        'mark': request.form.get('mark'),
        'sort': request.form.get('sort')
    }

    result = MenuModel().ModifyMenuRequest(menu_id=request.form.get('menu_id'),
                                           params=params)

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

    return ResultDeal(data=result)
Exemplo n.º 8
0
def QueryMenuByParam():
    params = {}
    if request.form.get('is_disabled'):
        params['is_disabled'] = True if request.form.get(
            'is_disabled') == 'true' else False
    if request.form.get('role_id'):
        params['role_id'] = request.form.get('role_id')

    result = MenuModel().QueryMenuByParamRequest(
        params=params,
        is_interface=True
        if request.form.get('is_interface') == 'true' else False)

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

    return ResultDeal(data=result)
Exemplo n.º 9
0
def GetMenu(menu_id):
    result = MenuModel().GetMenuRequest(menu_id=menu_id)
    return ResultDeal(data=result)
Exemplo n.º 10
0
def LockMenu():
    result = MenuModel().LockMenuRequest(menu_id=request.form.getlist('menu_id'))
    return ResultDeal(data=result)