Browse Source

for mratios

stanley-king 2 years ago
parent
commit
5385cfc81e

+ 5 - 4
crontab/control/minutes.php

@@ -447,6 +447,7 @@ class minutesControl extends BaseCronControl
             } catch (Exception $ex) {
                 Log::record($ex->getMessage(), Log::ERR);
             }
+
             sleep(1);
         }
     }
@@ -454,14 +455,14 @@ class minutesControl extends BaseCronControl
     private function stat_util()
     {
         //查找最早的充值中的单子
-        $update_earlist_sendtime = function () {
+        $update_earliest_ordertime = function () {
             $mod = Model('refill_detail');
             $time = $mod->getLatestSendTime();
-            wcache('earlist_sending', ['order_time' => $time], 'refill-stat-');
-            Log::record("earlist_sending={$time}",Log::DEBUG);
+            wcache('earliest_sending', ['order_time' => $time], 'refill-stat-');
+            Log::record("earliest_sending order_time={$time}",Log::DEBUG);
         };
 
-        $update_earlist_sendtime();
+        $update_earliest_ordertime();
     }
 
     /**

File diff suppressed because it is too large
+ 1952 - 0
docker/compose/workcuda/conf/php/php-debug.ini


+ 1 - 11
docker/compose/workcuda/conf/php/php.ini

@@ -1939,14 +1939,4 @@ ldap.max_links = -1
 ; tab-width: 4
 ; End:
 
-output_buffering = On
-
-[xdebug]
-xdebug.default_enable=1
-xdebug.remote_enable=1
-xdebug.remote_handler=dbgp
-xdebug.remote_host=192.168.3.220
-xdebug.remote_port=9300
-xdebug.remote_mode=req
-xdebug.remote_autostart=1
-xdebug.idekey=PHPSTORM
+output_buffering = On

+ 1 - 1
docker/compose/workcuda/slave-crond/docker-compose.yml

@@ -54,7 +54,7 @@ services:
     volumes:
       - ../../../../:/var/www/html
       - ../conf/etc/localtime:/etc/localtime:ro
-      - ../conf/php/php.ini:/usr/local/etc/php/php.ini
+      - ../conf/php/php-debug.ini:/usr/local/etc/php/php.ini
       - /mnt/upload:/var/www/html/data/upload
       - /mnt/shoplog:/var/www/html/data/log
     container_name: "panda-statutil"

+ 14 - 9
plot/refill/MerchantCalc.py

@@ -6,7 +6,7 @@ from matplotlib import ticker
 from io import BytesIO
 import numpy as np
 from .algorithm import calc_mchratios, calc_morder_send
-import time as time
+import time as stime
 import logging
 import redis
 
@@ -51,19 +51,24 @@ class MerchantCalc(object):
                 if client is None:
                     client = redis_client()
 
-                self.ratios(client)
+                self._ratios(client)
             except redis.RedisError as ex:
                 logger.error(ex)
             except Exception as ex:
                 logger.error(ex)
 
-    def ratios(self,rclient):
-        def earlist_time():
-            time = rclient.hget('nc_refill-stat-latest_sending','order_time')
-            return time
+    def _ratios(self, rclient):
+        def earliest_time():
+            order_time = rclient.hget('nc_refill-stat-earliest_sending', 'order_time')
+            if order_time is not None:
+                return int(order_time)
+            else:
+                return int(stime.time() - 86400)
+
+        start_time = earliest_time()
+        end_time = int(stime.time())
+        
+        logger.debug('start_time=%d end_time=%d', start_time, end_time)
 
-        time = earlist_time()
-        logger.debug('time=%d', time)
 
-        pass
     pass