Browse Source

Merge branch 'raccount' of 39.97.239.116:gyfl/xyzshop into raccount

xiaoyu 2 years ago
parent
commit
d13b5c34a7

+ 0 - 3
crontab/control/date.php

@@ -122,9 +122,6 @@ class dateControl extends BaseCronControl
         $sDate = date('Y-m-d',$start_date);
         $refill = new statistics\stat_refill();
         $refill->restat([$sDate]);
-
-        $clear = new refill\pdlog_clear();
-        $clear->clear($start_date,$end_date);
     }
 
     public function merchant_daytimeOp()

+ 2 - 2
data/config/dev/base.ini.php

@@ -55,14 +55,14 @@ if(SSH_TUNEL_PROD ==='local') {
     $config['db'][1]['dbport']       = '3306';
     $config['db'][1]['dbuser']       = 'root';
     $config['db'][1]['dbpwd']        = '55668899';
-    $config['db'][1]['dbname']       = 'ylshop';
+    $config['db'][1]['dbname']       = 'xyzshop';
     $config['db'][1]['dbcharset']    = 'UTF-8';
 
     $config['db']['slave'][0]['dbhost']     = SLAVE_DBHOST;
     $config['db']['slave'][0]['dbport']     = '3306';
     $config['db']['slave'][0]['dbuser']     = 'root';
     $config['db']['slave'][0]['dbpwd']      = '55668899';
-    $config['db']['slave'][0]['dbname']     = 'ylshop';
+    $config['db']['slave'][0]['dbname']     = 'xyzshop';
     $config['db']['slave'][0]['dbcharset']  = 'UTF-8';
 }
 elseif(SSH_TUNEL_PROD === 'xyz') {

+ 1 - 1
docker/compose/xyz/conf/crontab/slave_root

@@ -14,7 +14,7 @@
 #0   1   *   *   *   php /var/www/html/crontab/index.php date _order_stats
 #0   0    *   *   *   php /var/www/html/crontab/index.php date merchant_available
 */1    *   *   *   *   php /var/www/html/crontab/index.php minutes update_channel_balance
-0   1   *   *   *   php /var/www/html/crontab/index.php date refill_clear
+50   1   *   *   *   php /var/www/html/crontab/index.php date refill_clear
 #0   8   *   *   *   sh /mnt/xyzshop/util/purge.sh #挪到了系统的crontab 执行了
 
 0   23   *   *   *   php /var/www/html/crontab/index.php date merchant_nightime

+ 11 - 3
helper/refill/ops/order_clear.php

@@ -14,18 +14,26 @@ class order_clear
             $end = $start + 3600;
             $cond = ['order_time&order_time' => ['_multi' => true, ['egt', $start], ['lt', $end]], 'inner_status' => 0];
 
+            $order_id = 0;
+
             $i = 0;
             while (true)
             {
-                $start = $i * 1000;
+                $cond['order_id'] = ['gt', $order_id];
+//                $start = $i * 1000;
+                $start = 0;
                 $items = Model()->table('refill_order')
-                    ->field('mchid,mch_order,order_time')
+                    ->field('order_id,mchid,mch_order,order_time')
                     ->where($cond)
-                    ->order('order_time asc')->limit("{$start},1000")->select();
+                    ->order('order_id asc')->limit("{$start},1000")->select();
                 $i++;
 
                 if(empty($items)) break;
+
+                $last_item = end($items);
+                $order_id = intval($last_item['order_id']);
                 foreach ($items as $item) {
+                    unset($item['order_id']);
                     yield $item;
                 }
             }

+ 0 - 21
helper/refill/policy/quaility.php

@@ -349,27 +349,6 @@ class Quality
             $qualities_log("{$mchid}-{$card_type}-{$spec} pre_qualities",$pre_qualities);
 
 
-
-//            $times_qualities = $times_checker(true, $all_qualities, $used_times);
-//            $time_qualities = $timeout_checker(true, $all_qualities, $left_time);
-//            $pre_qualities = array_intersect($times_qualities, $time_qualities, $all_qualities);
-//
-//            if (count($pre_qualities) < count($all_qualities)) {
-//                $match_ratio = $this->mRatioCtl->ratio_match($mchid, $org_quality, $card_type, $spec, $all_qualities);
-//                Log::record("mchid={$mchid} must calc next quality match_ratio={$match_ratio}",Log::DEBUG);
-//            } else {
-//                $match_ratio = true;
-//            }
-//
-//            if (!$match_ratio) {
-//                $times_qualities = $times_checker(false, $all_qualities, $used_times);
-//                $time_qualities  = $timeout_checker(false, $all_qualities, $left_time);
-//                $pre_qualities = array_intersect($times_qualities, $time_qualities, $all_qualities);
-//
-//                Log::record("calc_quality timeing_checker result is empty", Log::DEBUG);
-//
-//            }
-
             if(!$timeing_checker($pre_qualities)) {
                 $pre_qualities = [];
                 Log::record("calc_quality timeing_checker result is empty", Log::DEBUG);

+ 1 - 0
plot/refill/MAmountCalc.py

@@ -50,6 +50,7 @@ class MAmountCalc(MerchantCalc):
                 mamounts[_mchid]['send_amounts'] += send_amounts
                 mamounts[_mchid]['lack_amounts'] += lack_amounts
 
+
         result = dict()
         for _mchid, _val in mamounts.items():
             _send_amounts = round(_val['send_amounts'], 2)

+ 11 - 2
plot/refill/WriterConsumer.py

@@ -10,18 +10,27 @@ class WriterConsumer(Thread):
         self._messages = Queue(1000000)
         self._stopped = False
         self._handler = handler
-        self._max_threshold  = 5000
+        self._max_threshold  = 50000
         self._max_batch_size = 200000
         self._name = name
 
     def run(self):
         while True:
             size = self._messages.qsize()
-            # log.debug("%s messages size=%d", self._name, size)
+            log.debug("%s messages size=%d", self._name, size)
+            # if size < self._max_threshold:
+            #     time.sleep(1)
+            # else:
+            #     self._batch()
+            #
+            # if self._stopped:
+            #     self._batch()
+
             if size > self._max_threshold:
                 self._batch()
             else:
                 self._single()
+
             if self._stopped and self._messages.empty():
                 break
 

+ 3 - 2
test/TestRefillClear.php

@@ -23,10 +23,11 @@ class TestRefillClear extends TestCase
     //docker-compose run -d phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillClear::testOrderClear)( .*)?$/" --test-suffix TestRefillClear.php /var/www/html/test
     public function testOrderClear()
     {
-        $start_date = strtotime('2021-09-11');
-        $end_date   = strtotime('2022-01-01');
+        $start_date = strtotime('2022-10-01');
+        $end_date   = strtotime('2022-10-02');
         $clear = new refill\order_clear();
         $clear->clear($start_date,$end_date);
+
     }
 
     //docker-compose run -d phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillClear::testOrderClearYL)( .*)?$/" --test-suffix TestRefillClear.php /var/www/html/test

+ 12 - 3
test/TestRefillCommand.php

@@ -31,6 +31,18 @@ class TestRefillCommand extends TestCase
         $refill->restat($dates);
     }
 
+    //docker-compose run -d phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillCommand::testRefillStatYesterday)( .*)?$/" --test-suffix TestRefillCommand.php /var/www/html/test
+    public function testRefillStatYesterday()
+    {
+        Log::record("start testRefillStatYesterday",Log::DEBUG);
+        $end_date = strtotime(date('Y-m-d',time()));
+        $start_date  = $end_date - 86400;
+
+        $sDate = date('Y-m-d',$start_date);
+        $refill = new statistics\stat_refill();
+        $refill->restat([$sDate]);
+    }
+
     public function testCurDate()
     {
         $end_date = strtotime(date('Y-m-d',time()));
@@ -42,8 +54,5 @@ class TestRefillCommand extends TestCase
         $sDate = date('Y-m-d',$start_date);
         $refill = new statistics\stat_refill();
         $refill->restat([$sDate]);
-
-        $clear = new refill\pdlog_clear();
-        $clear->clear($start_date,$end_date);
     }
 }