소스 검색

format code

stanley-king 1 년 전
부모
커밋
99e450a020
2개의 변경된 파일16개의 추가작업 그리고 8개의 파일을 삭제
  1. 8 4
      helper/refill/api/xyz/xinma/RefillCallBack.php
  2. 8 4
      test/TestRefill.php

+ 8 - 4
helper/refill/api/xyz/xinma/RefillCallBack.php

@@ -26,23 +26,27 @@ class RefillCallBack implements refill\IRefillCallBack
 
     public function notify($params)
     {
-        $extractOfficialSn = function ($officialSnStr) {
+        $extractOfficialSn = function ($sms)
+        {
             $officialSn = '';
 
-            $matches = [];
-            if (preg_match_all("/(\d+)/", $officialSnStr, $matches)) {
-                foreach ($matches[1] as $item) {
+            if (preg_match_all("/(\d+)/", $sms, $matches))
+            {
+                foreach ($matches[1] as $item)
+                {
                     if (strlen($officialSn) < strlen($item)) {
                         $officialSn = $item;
                     }
                 }
             }
+
             return $officialSn;
         };
 
         $status = intval($params['status']);
         $order_sn = $params['user_order_id'];
         $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
+
         if (empty($order_info)) {
             return [false, false, false, false, ''];
         }

+ 8 - 4
test/TestRefill.php

@@ -5589,17 +5589,20 @@ class TestRefill extends TestCase
 
     public function testXinmaOfficialSn()
     {
-        $extractOfficialSn = function ($officialSnStr) {
+        $extractOfficialSn = function ($officialSnStr)
+        {
             $officialSn = '';
 
-            $matches = [];
-            if (preg_match_all("/(\d+)/", $officialSnStr, $matches)) {
-                foreach ($matches[1] as $item) {
+            if (preg_match_all("/(\d+)/", $officialSnStr, $matches))
+            {
+                foreach ($matches[1] as $item)
+                {
                     if (strlen($officialSn) < strlen($item)) {
                         $officialSn = $item;
                     }
                 }
             }
+
             return $officialSn;
         };
 
@@ -5610,5 +5613,6 @@ class TestRefill extends TestCase
 
 }
 
+
 //docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefill::testLoadBlack)( .*)?$/" --test-suffix TestRefill.php /var/www/html/test
 //docker-compose -f ./docker-compose-dev.yml run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefill::testCall)( .*)?$/" --test-suffix TestRefill.php /var/www/html/test