ayHaru преди 4 години
родител
ревизия
afdb5ad76a

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

@@ -45,11 +45,11 @@ $config['gip'] 		= 0;
 $config['dbdriver'] = 'mysqli';
 $config['tablepre']	= 'lrlz_';
 
-//define('SSH_TUNEL_PROD',true);
-define('SSH_TUNEL_PROD','xyz');
+define('SSH_TUNEL_PROD','local');
+//define('SSH_TUNEL_PROD','xyz');
 //define('SSH_TUNEL_PROD','lingzh');
 
-if(SSH_TUNEL_PROD === false) {
+if(SSH_TUNEL_PROD ==='local') {
     $config['db'][1]['dbhost']       = MASTER_DBHOST;
     $config['db'][1]['dbport']       = '3306';
     $config['db'][1]['dbuser']       = 'root';

+ 5 - 1
helper/refill/RefillBase.php

@@ -328,7 +328,11 @@ class RefillBase
                 'quality' => $quality,'order_id' => $order_id];
 
             util::incr_commit_pre($channel_name,$card_type,$amount,$quality);
-            [$state, $errmsg,$neterr] = $provider->add($card_no, $card_type, $amount, $params);
+
+            $start = microtime(true);
+            [$state, $errmsg, $neterr] = $provider->add($card_no, $card_type, $amount, $params);
+            Log::record(sprintf(" %s add request time=%.6f", $channel_name,microtime(true) - $start), Log::DEBUG);
+
             if ($state)
             {
                 //提交成功

+ 6 - 5
helper/refill/api/xyz/afand/RefillPhone.php

@@ -30,6 +30,7 @@ class RefillPhone extends refill\IRefillPhone
         return $params;
     }
 
+    //[$state, $errmsg,$neterr]
     public function add($card_no, $card_type, $amount, $params)
     {
         $params = $this->req_params($card_no, $amount, $params['order_sn']);
@@ -39,10 +40,12 @@ class RefillPhone extends refill\IRefillPhone
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false);
         if ($resp === false) {
             return [false, '系统错误', true];
-        } else {
+        }
+        else
+        {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if($resp === false) {
+            if ($resp === false) {
                 return [false, '系统错误', true];
             }
             $code = intval($resp['code']);
@@ -77,13 +80,11 @@ class RefillPhone extends refill\IRefillPhone
             }
             $code = intval($resp['code']);
             if ($code === 0) {
-                $order_state = -1;
                 if ($resp['data']['status'] == '已支付') {
                     $order_state = ORDER_STATE_SUCCESS;
                 } elseif ($resp['data']['status'] == '支付失败') {
                     $order_state = ORDER_STATE_CANCEL;
-                }
-                if ($order_state == -1) {
+                } else {
                     return [false, $resp['data']];
                 }
                 return [true, $order_state];

+ 4 - 0
helper/refill/api/xyz/gftd/RefillOil.php

@@ -119,6 +119,10 @@ class RefillOil extends refill\IRefillOil
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
 
+            if($resp === false) {
+                return [false,'系统错误',true];
+            }
+
             if($resp['code'] == 0)
             {
                 refill\util::inc_card($card_no,$card_info);

+ 4 - 1
helper/refill/api/xyz/gftdsinop/RefillOil.php

@@ -119,6 +119,10 @@ class RefillOil extends refill\IRefillOil
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
 
+            if($resp === false) {
+                return [false,'系统错误',true];
+            }
+
             if($resp['code'] == 0)
             {
                 refill\util::inc_card($card_no,$card_info);
@@ -138,7 +142,6 @@ class RefillOil extends refill\IRefillOil
         $params['outOrderNumber'] = $order_sn;
 
         return $params;
-
     }
 
     public function query($refill_info)

+ 10 - 1
helper/refill/api/xyz/yunling/RefillCallBack.php

@@ -7,6 +7,7 @@ require_once(BASE_HELPER_RAPI_PATH . '/yunling/config.php');
 
 
 use refill;
+use Log;
 
 class RefillCallBack implements refill\IRefillCallBack
 {
@@ -31,6 +32,8 @@ class RefillCallBack implements refill\IRefillCallBack
 
     public function notify($params)
     {
+        Log::record("notify params:" . json_encode($params),Log::DEBUG);
+
         $status = intval($params['resultno']);
         $order_sn = $params['sporderid'];
         $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
@@ -38,7 +41,13 @@ class RefillCallBack implements refill\IRefillCallBack
             return [false, false, false,false];
         }
         $order_id = $order_info['order_id'];
-        $data['official_sn'] = strtolower($params['supnumber']) == 'null' ? '' : $params['supnumber'];
+
+        if(empty($params['supnumber'])) {
+            $data['official_sn'] = '';
+        }
+        else {
+            $data['official_sn'] = strtolower($params['supnumber']) == 'null' ? '' : $params['supnumber'];
+        }
 
         if ($status === 1) {
             Model('refill_order')->edit($order_id, $data);

+ 10 - 2
test/TestRedis.php

@@ -1,4 +1,4 @@
-<?php declare(strict_types=1);
+<?php declare(strict_types=0);
 
 use PHPUnit\Framework\TestCase;
 define('APP_ID', 'test');
@@ -176,11 +176,19 @@ class TestRedis extends TestCase
 
     public function testSHA1()
     {
-        $x = sha1('xxxxxxxx',true);
+        $params['supnumber'] = 'null';
+        $y = strtolower($params['supnumber']) == 'null' ? '' : $params['supnumber'];
+        $z = strtolower($params['supnumber']) ?? '';
+
+
+        $params = [];
+        $y = strtolower($params['supnumber']) == 'null' ? '' : $params['supnumber'];
+        $z = strtolower($params['supnumber']) ?? '';
     }
 
     public static function tearDownAfterClass() : void
     {
 
+
     }
 }

+ 14 - 1
test/TestTime.php

@@ -27,7 +27,20 @@ class TestTime extends TestCase
 
     public function testMicro()
     {
-        $y = (float) microtime();
+        $start = microtime(true);
+        $end = microtime(true);
+        Log::record("request time=" . ($end - $start),Log::DEBUG);
+
+        for ($i = 0; $i < 10000; $i++)
+        {
+            $x = microtime();
+            $y = (float)$x;
+            Log::record("{$y}",Log::DEBUG);
+        }
+
+        $x = microtime();
+        $y = (float)$x;
+        $z = (int)$x;
         $x = sprintf('%03d', $y * 1000000);
     }