def addLog(self, operator_id, hospital_code, menu_code, operation_context, operation_id, operation_no=""): if not operator_id or not hospital_code or not menu_code or not operation_context: raise BaseError(801) lstData = { 'operator_id': operator_id, 'hospital_code': hospital_code, 'menu_code': menu_code, 'operation_context': operation_context, 'operation_id': operation_id, 'create_time': time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())), 'operation_no': operation_no } id = self.save(lstData, table='public.operation_log') if id <= 0: raise BaseError(703) return True
def getRequestData(self): try: objRequestBody = ujson.loads(self.request.body.decode('utf-8')) #objRequestBody=json.loads(self.request.body.decode('utf-8')) except: raise BaseError(801) # 参数错误 if objRequestBody == None: raise BaseError(801) # 参数错误 else: return objRequestBody
def addLog2(self, logData): if not logData['operator_id'] or not logData[ 'hospital_code'] or not logData['menu_code'] or not logData[ 'operation_context'] or not logData['operation_id']: raise BaseError(801) logData['create_time'] = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())) id = self.save(logData, table='public.operation_log') if id <= 0: raise BaseError(703) return True
def gen_status(self, *args, **kwargs): result = None, None try: result = func(self, *args, **kwargs) func(self, *args, **kwargs) except: raise BaseError(801) # 参数错误 return result
def getRequestArguments(self): try: data = self.request.arguments if data == {}: return {} #objRequestBody=json.loads(self.request.arguments.decode('utf-8')) objData = {} for (k, v) in data.items(): objData[k] = v[0].decode('utf-8') return objData except: raise BaseError(801) # 参数错误
def __init(self, *args, **kwargs): self._db_ = None self.objUserInfo = None self._now_time_ = None self._now_date_ = None self.objUserInfo = self.getUserToObjct() if not self.objUserInfo: if self.checkUnauthAccess(): return raise BaseError(602) # 未登录
def checkAppKey(self): if self.request.headers.get('app-key') != config.App_Key: raise BaseError(601)