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)
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)
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)
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)
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)
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)
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)
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)
def GetMenu(menu_id): result = MenuModel().GetMenuRequest(menu_id=menu_id) return ResultDeal(data=result)
def LockMenu(): result = MenuModel().LockMenuRequest(menu_id=request.form.getlist('menu_id')) return ResultDeal(data=result)