Răsfoiți Sursa

[update] 修改工厂类的路径问题

jhao104 9 ani în urmă
părinte
comite
479c7e231a
2 a modificat fișierele cu 14 adăugiri și 4 ștergeri
  1. 7 0
      DB/DbClient.py
  2. 7 4
      DB/SsdbClient.py

+ 7 - 0
DB/DbClient.py

@@ -12,8 +12,12 @@
 """
 """
 __author__ = 'JHao'
 __author__ = 'JHao'
 
 
+import os
+import sys
 from Util.GetConfig import GetConfig
 from Util.GetConfig import GetConfig
 
 
+sys.path.append(os.path.dirname(os.path.abspath(__file__)))
+
 
 
 class DbClient(object):
 class DbClient(object):
     """
     """
@@ -52,6 +56,9 @@ class DbClient(object):
     def pop(self, **kwargs):
     def pop(self, **kwargs):
         return self.client.pop(**kwargs)
         return self.client.pop(**kwargs)
 
 
+    def changeTable(self, name):
+        self.client.changeTable(name)
+
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":
     account = DbClient().pop()
     account = DbClient().pop()

+ 7 - 4
DB/SsdbClient.py

@@ -33,7 +33,7 @@ class SsdbClient(object):
         self.name = name
         self.name = name
         self.__conn = SSDB(connection_pool=BlockingConnectionPool(host=host, port=port))
         self.__conn = SSDB(connection_pool=BlockingConnectionPool(host=host, port=port))
 
 
-    def get(self, **kwargs):
+    def get(self):
         """
         """
         get an item from the queue front
         get an item from the queue front
         :return:
         :return:
@@ -41,19 +41,22 @@ class SsdbClient(object):
         value = self.__conn.qfront(name=self.name)
         value = self.__conn.qfront(name=self.name)
         return value
         return value
 
 
-    def put(self, value, **kwargs):
+    def put(self, value):
         """
         """
         put an  item in the back of a queue
         put an  item in the back of a queue
         :param value:
         :param value:
         :return:
         :return:
         """
         """
         value = json.dump(value, ensure_ascii=False).encode('utf-8') if isinstance(value, (dict, list)) else value
         value = json.dump(value, ensure_ascii=False).encode('utf-8') if isinstance(value, (dict, list)) else value
-        return self.__conn.qpush_back(self.name, value, **kwargs)
+        return self.__conn.qpush_back(self.name, value)
 
 
-    def pop(self, **kwargs):
+    def pop(self):
         """
         """
         pop an item from the queue front
         pop an item from the queue front
         :return:
         :return:
         """
         """
         value = self.__conn.qpop_front(self.name)
         value = self.__conn.qpop_front(self.name)
         return value[0] if value else value
         return value[0] if value else value
+
+    def changeTable(self, name):
+        self.name = name