stanley-king 3 anos atrás
pai
commit
2c33dab164

+ 11 - 10
core/framework/function/http.php

@@ -18,8 +18,6 @@ function http_request($url, $params = array(), $method = 'GET', $multi = false,
     $method = strtoupper($method);
     $ci = curl_init();
     curl_setopt($ci, CURLOPT_USERAGENT, 'PHP-SDK OAuth2.0');
-//    curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 10);
-//    curl_setopt($ci, CURLOPT_TIMEOUT, 10);
     curl_setopt($ci, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ci, CURLOPT_SSL_VERIFYHOST, false);
@@ -63,9 +61,10 @@ function http_request($url, $params = array(), $method = 'GET', $multi = false,
     }
 
     $response = curl_exec($ci);
-    if($response == false) {
+    if($response === false) {
         $err = curl_error($ci);
-        Log::record("http_request err={$err}",Log::ERR);
+        $no  = curl_errno($ci);
+        Log::record("netmodule http_request errno={$no} err={$err}",Log::ERR);
     }
 
     curl_close($ci);
@@ -81,8 +80,6 @@ function http_post_data($url, $body, $headers = array())
 
     $ci = curl_init();
     curl_setopt($ci, CURLOPT_USERAGENT, 'PHP-SDK OAuth2.0');
-    curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 10);
-    curl_setopt($ci, CURLOPT_TIMEOUT, 10);
     curl_setopt($ci, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ci, CURLOPT_SSL_VERIFYHOST, false);
@@ -97,9 +94,10 @@ function http_post_data($url, $body, $headers = array())
     }
 
     $response = curl_exec($ci);
-    if($response == false) {
+    if($response === false) {
         $err = curl_error($ci);
-        Log::record("http_post_data err={$err}",Log::ERR);
+        $no  = curl_errno($ci);
+        Log::record("netmodule http_post_data errno={$no} err={$err}",Log::ERR);
     }
     curl_close($ci);
 
@@ -115,8 +113,6 @@ function https_request($url, $params = array(), $method = 'GET', $multi = false,
     $method = strtoupper($method);
     $ci = curl_init();
     curl_setopt($ci, CURLOPT_USERAGENT, 'PHP-SDK OAuth2.0');
-    curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 10);
-    curl_setopt($ci, CURLOPT_TIMEOUT, 10);
     curl_setopt($ci, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ci, CURLOPT_SSL_VERIFYHOST, 2);
@@ -158,6 +154,11 @@ function https_request($url, $params = array(), $method = 'GET', $multi = false,
     }
 
     $response = curl_exec($ci);
+    if($response === false) {
+        $err = curl_error($ci);
+        $no  = curl_errno($ci);
+        Log::record("netmodule https_request errno={$no} err={$err}",Log::ERR);
+    }
     curl_close($ci);
 
     return $response;

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

@@ -46,8 +46,8 @@ $config['gip'] 		= 0;
 $config['dbdriver'] = 'mysqli';
 $config['tablepre']	= 'lrlz_';
 
-define('SSH_TUNEL_PROD','local');
-//define('SSH_TUNEL_PROD','xyz');
+//define('SSH_TUNEL_PROD','local');
+define('SSH_TUNEL_PROD','xyz');
 //define('SSH_TUNEL_PROD','lingzh');
 
 if(SSH_TUNEL_PROD ==='local') {

+ 3 - 1
helper/refill/policy/quaility.php

@@ -106,8 +106,10 @@ class Quality
         $total_times = 0;
         foreach ($qualities as $quality)
         {
-            $total_times += $caller->calc_times($quality);
+            $cur_times = $caller->calc_times($quality);
+            if($cur_times <= 0) continue;
 
+            $total_times += $cur_times;
             if($total_times > $times) {
                 $result[] = $quality;
             }

+ 1 - 1
helper/refill_proxy.php

@@ -144,7 +144,7 @@ class refill_proxy
         $response = curl_exec($ci);
         if($response == false) {
             $err = curl_error($ci);
-            Log::record("http_post_data err={$err}",Log::ERR);
+            Log::record("http_request err={$err}",Log::ERR);
         }
 
         curl_close($ci);

+ 11 - 0
test/TestRedis.php

@@ -28,6 +28,12 @@ function sub_callback($redis, $chan, $msg)
     }
 }
 
+function hello(&$name = '')
+{
+    Log::record("name = {$name}",Log::DEBUG);
+    $name = "yes";
+}
+
 class TestRedis extends TestCase
 {
     public static function setUpBeforeClass() : void
@@ -35,6 +41,11 @@ class TestRedis extends TestCase
         Base::run_util();
     }
 
+    public function testRef()
+    {
+        hello($val);
+    }
+
     public function testIncr()
     {
         $key = '100905';

+ 3 - 0
test/TestRefillStats.php

@@ -25,3 +25,6 @@ class TestRefillStats extends TestCase
         $refill->run();
     }
 }
+
+//docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillStats::testLatestDay)( .*)?$/" --test-suffix TestRefillStats.php /var/www/html/test
+