def _post(self): # if self.verifyFlag == 1 and self.status == 0: try: # print("add") indexDirectory = Config().get_content("indexFilePath")["filepath"] dbname = self.get_argument('dbname', None) # print(dbname) # rowData 是json的dict类型数据 rowData = self.get_argument('rowData', None) # print(rowData) if not dbname or not rowData: raise ValueError if isinstance(rowData, str): rowData = json.loads(rowData) if isinstance(rowData, list): for i in rowData: incremental_index(indexdir=indexDirectory, indexname=dbname, rowData=i) elif isinstance(rowData, dict): incremental_index(indexdir=indexDirectory, indexname=dbname, rowData=rowData) return result(status=2000) except Exception as e: my_log.error(e) return result(status=5003)
def _post(self): user = Config().get_content("user") user_name = self.get_argument("UserName", None) pass_word = self.get_argument("PassWord", None) if user_name and pass_word: if str(user["user_name"]) == str(user_name) and str( user["pass_word"]) == str(pass_word): self.session["is_login"] = True return result(status=2000) else: return result(status=4005) else: return result(status=4005)
def _post(self): try: tableNameList = WhooshParameter.tableNameList dataBaseList = WhooshParameter.dataBaseList uniqueValueList = WhooshParameter.uniqueValueList indexDirectory = Config().get_content("indexFilePath")["filepath"] ''' try: indexDirectory = Config().get_content("indexFilePath")["filepath"] except Exception as e: my_log.error(e) indexDirectory = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'indexdir') ''' app(tableNameList, dataBaseList, uniqueValueList, indexDirectory) return result(status=2000) except Exception as e: my_log.error(e) return result(status=5003)
def _post(self): # if self.verifyFlag == 1 and self.status == 0: try: status = 2000 indexdir = Config().get_content("indexFilePath")["filepath"] indList = WhooshParameter.tableNameList # 客户端传递过来查询的内容 clientContent = self.get_argument("clientContent", None) if clientContent: data = SearchData(indexdir, indList, clientContent) else: raise ValueError except Exception as e: my_log.error(e) status = 5003 data = [[], [], []] return result(status=status, value=data)
def _post(self): # if self.verifyFlag == 1 and self.status == 0: status = 2000 try: indexDirectory = Config().get_content("indexFilePath")["filepath"] dbname = self.get_argument('dbname', None) # rowData 是json的dict类型数据 rowData = self.get_argument('rowData', None) if not dbname or not rowData: raise ValueError if isinstance(rowData, str): rowData = json.loads(rowData) update_index(indexdir=indexDirectory, indexname=dbname, rowData=rowData) # return json.dumps(result(status=2000), ensure_ascii=False) except Exception as e: my_log.error(e) status = 5003 return result(status=status)
def noLogin(self): return json.dumps(result(status=4005))
def _post(self): if self.verifyFlag == 1 and self.status == 0: return json.dumps(result(status=2000, value="hello world!")) else: return self.noLogin()
def _post(self): user = self.get_argument('user', None) print("post", user) ret = json.dumps(result(status=2000, value="hello world!")) return ret
def noLogin(self): return result(status=4005)