def CreateInterface(): result = InterfaceModel().CreateInterfaceRequest(request.form) if type(result).__name__ == 'str': return ResultDeal(msg=result, code=-1) return ResultDeal(data=result)
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)
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)
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)
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)
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)
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)
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)
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)