stanley-king 3 năm trước cách đây
mục cha
commit
43c7312661

+ 7 - 7
helper/refill/ProviderManager.php

@@ -24,10 +24,10 @@ class ProviderManager
 
     public function __construct()
     {
-//        $this->mOpenedProviderNames = [];
-//        $this->mAllQMapPTS = [];
-//        $this->mProviders = [];
-//        $this->mSpecTypes = [];
+        $this->mOpenedProviderNames = [];
+        $this->mAllQMapPTS = [];
+        $this->mProviders = [];
+        $this->mSpecTypes = [];
     }
 
     public function getQPTA()
@@ -52,9 +52,9 @@ class ProviderManager
         foreach ($cfgs as $item)
         {
             $name = $item['name'];
-//            if(!array_key_exists($name,$channels) || $channels[$name]['opened'] == false) {
-//                continue;
-//            }
+            if(!array_key_exists($name,$channels) || $channels[$name]['opened'] == false) {
+                continue;
+            }
 
             $cfg = $item['cfg'];
             $provider = $this->create_provider($name,$cfg,$refill_type);

+ 1 - 1
helper/refill/RefillBase.php

@@ -410,7 +410,7 @@ class RefillBase
                         $trans->commit();
                     }
                     else {
-                        Log::record(sprintf(__METHOD__ . "request time=%.6f", microtime(true) - $start), Log::DEBUG);
+                        Log::record(sprintf(__METHOD__ . " request time=%.6f", microtime(true) - $start), Log::DEBUG);
                     }
                 }
                 else

+ 3 - 3
helper/refill/policy/chctl.php

@@ -79,9 +79,9 @@ class chctl
                 foreach ($items as $item)
                 {
                     $name = $item['name'];
-//                    if(!algorithm::binary_search($opened_names,$name)) {
-//                        continue;
-//                    }
+                    if(!algorithm::binary_search($opened_names,$name)) {
+                        continue;
+                    }
 
                     $amount = $item['amount'];
                     $card_type = $item['type'];

+ 3 - 3
helper/refill/policy/merchant_price.php

@@ -33,9 +33,9 @@ class merchant_price
             foreach ($items as $item)
             {
                 $mchid = intval($item['mchid']);
-//                if(!algorithm::binary_search($mchids,$mchid)) {
-//                    continue;
-//                }
+                if(!algorithm::binary_search($mchids,$mchid)) {
+                    continue;
+                }
 
                 $card_types = $item['card_types'];
                 $price = ncPriceFormat($item['price']);

+ 6 - 6
helper/refill/policy/mgroup.php

@@ -160,9 +160,9 @@ class rgroup_ctl
         foreach ($mchitems as $item)
         {
             $mchid = intval($item['mchid']);
-//            if(!algorithm::binary_search($opened_merchants,$mchid)) {
-//                continue;
-//            }
+            if(!algorithm::binary_search($opened_merchants,$mchid)) {
+                continue;
+            }
 
             $ids_text = $item['group_ids'];
             if (empty($ids_text)) continue;
@@ -184,9 +184,9 @@ class rgroup_ctl
                     foreach ($chitems as $text)
                     {
                         [$spec, $card_type, $quality, $chname] = $this->parase($text);
-//                        if(!algorithm::binary_search($opened_names,$chname)) {
-//                            continue;
-//                        }
+                        if(!algorithm::binary_search($opened_names,$chname)) {
+                            continue;
+                        }
                         $mchchannel->add_channel($spec, $card_type, $quality, $chname);
                     }
 

+ 22 - 16
rdispatcher/coall.php

@@ -94,20 +94,18 @@ function subscribe_message(&$quit, &$redis, $channels,$looper)
                 }
                 elseif($type == 'ratio')
                 {
-//                    if($fLoading == false)
-//                    {
-//                        $ins = Cache::getInstance('cacheredis');
-//                        $val = $ins->get_org('channel_ratios');
-//
-//                        if(empty($val)) return;
-//                        $val = json_decode($val,true);
-//                        if(empty($val)) return;
-//                        $ratios = $val['ratios'];
-//                        if(empty($ratios)) return;
-//
-////                        refill\RefillFactory::instance()->UpdateRatio($ratios);
-//
-//                    }
+                    if($fLoading == false)
+                    {
+                        $ins = Cache::getInstance('cacheredis');
+                        $val = $ins->get_org('channel_ratios');
+
+                        if(empty($val)) return;
+                        $val = json_decode($val,true);
+                        if(empty($val)) return;
+                        $ratios = $val['ratios'];
+                        if(empty($ratios)) return;
+                        refill\RefillFactory::instance()->UpdateRatio($ratios);
+                    }
                 }
                 else {
                     Log::record("subscribe_message dont not handle mgs:{$channel}-{$type}",Log::DEBUG);
@@ -133,12 +131,20 @@ for ($i = 0; $i < $process_count;$i++)
         Log::record("Swoole::Process init",Log::DEBUG);
         Base::run_util();
         refill\RefillFactory::instance();
-        set_error_handler('handle_error');
         Log::record("Swoole::Process init success",Log::DEBUG);
 
         $sub_quit = false;
         $sub_redis = null;
         $looper = new processor(false);
+        register_shutdown_function(function () use ($looper)
+        {
+            $error = error_get_last();
+            if(!empty($error)) {
+                $msg = "register_shutdown_function type:{$error['type']}\n message:{$error['message']}\n file={$error['file']} line={$error['line']}";
+                Log::record("$msg",Log::ERR);
+            }
+        });
+        set_error_handler('handle_error');
 
         go(function () use (&$sub_quit,&$sub_redis,$looper) {
             subscribe_message($sub_quit,$sub_redis,['refill'],$looper);
@@ -150,7 +156,7 @@ for ($i = 0; $i < $process_count;$i++)
 
         Swoole\Process::signal(SIGTERM, function($signal_num) use ($worker,&$sub_quit,$sub_redis,$looper)
         {
-            Log::record("signal call SIGTERM begin = $signal_num, #{$worker->pid}",Log::DEBUG);
+            Log::record("signal call SIGTERM begin signum={$signal_num}, pid={$worker->pid}",Log::DEBUG);
 
             set_error_handler(null);
             try {