Your Name il y a 2 ans
Parent
commit
07bb405def

+ 5 - 1
plot/refill/CalcBase.py

@@ -19,6 +19,9 @@ class CalcBase(object):
     def _calc_handler(self, rclient):
         pass
 
+    def _reader(self):
+        return None
+
     def run(self):
         def redis_client():
             pool = redis.ConnectionPool(host=self._mRHost, port=self._mRPort)
@@ -40,7 +43,8 @@ class CalcBase(object):
                 time.sleep(1)
                 loop += 1
 
-    def calc_time(self, reader, start_time: int, end_time: int):
+    def calc_time(self, start_time: int, end_time: int):
+        reader = self.get_reader()
         end_time = reader.near_stamp(end_time, False)
         if end_time is None:
             raise Exception('end_time data is empty')

+ 0 - 1
plot/refill/MProfitRatioCalc.py

@@ -1,4 +1,3 @@
-from .CalcBase import CalcBas
 from .MerchantCalcBase import MerchantCalcBase
 
 

+ 3 - 2
plot/refill/MerchantCalcBase.py

@@ -5,5 +5,6 @@ from .algorithm import calc_morder_lack
 
 
 class MerchantCalcBase(CalcBase):
-    def _calc_handler(self, rclient):
-        pass
+    def _reader(self):
+        return MerchantReader()
+    pass