示例#1
0
 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)
示例#3
0
 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)
示例#4
0
 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)
示例#5
0
 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)
示例#6
0
 def noLogin(self):
     return json.dumps(result(status=4005))
示例#7
0
 def _post(self):
     if self.verifyFlag == 1 and self.status == 0:
         return json.dumps(result(status=2000, value="hello world!"))
     else:
         return self.noLogin()
示例#8
0
 def _post(self):
     user = self.get_argument('user', None)
     print("post", user)
     ret = json.dumps(result(status=2000, value="hello world!"))
     return ret
示例#9
0
 def noLogin(self):
     return result(status=4005)