浏览代码

调试入库

lizhen_gitee 9 月之前
父节点
当前提交
6776ad80d3
共有 3 个文件被更改,包括 14 次插入4 次删除
  1. 3 3
      application/chat/Events.php
  2. 2 1
      application/chat/start_gateway.php
  3. 9 0
      application/index/controller/Test.php

+ 3 - 3
application/chat/Events.php

@@ -47,7 +47,7 @@ class Events
     {
          //echo $message.PHP_EOL;
          //file_put_contents('1.json',$message.PHP_EOL,FILE_APPEND);
-         //$info = Db::name('gateway_test')->insertGetId(['msg'=>'[msg]'.$message,'datetime'=>date('Y-m-d H:i:s')]);
+         $info = Db::name('gateway_test')->insertGetId(['msg'=>$message,'datetime'=>date('Y-m-d H:i:s')]);
 
          Gateway::sendToAll($client_id.':'.$message);
 
@@ -77,9 +77,9 @@ class Events
     public static function onConnect($client_id)
     {
         // 向当前client_id发送数据
-        Gateway::sendToClient($client_id, "Hello $client_id");
+//        Gateway::sendToClient($client_id, "Hello $client_id");
         // 向所有人发送
-        Gateway::sendToAll("$client_id login");
+//        Gateway::sendToAll("$client_id login");
     }
 
 

+ 2 - 1
application/chat/start_gateway.php

@@ -31,7 +31,8 @@ $gateway->startPort = 2350;
 // 心跳间隔
 $gateway->pingInterval = 10;
 // 心跳数据
-$gateway->pingData = '{"type":"ping"}';
+//$gateway->pingData = '{"type":"ping"}';
+$gateway->pingData = '';
 // 服务注册地址
 $gateway->registerAddress = '127.0.0.1:2345';
 

+ 9 - 0
application/index/controller/Test.php

@@ -14,4 +14,13 @@ class Test extends Controller
         $Gateway::sendToAll('来自服务端的主动推送'.date('Y-m-d H:i:s'));
 
     }
+
+    public function test2(){
+        //血糖,5秒
+        $str = '  7.2mmol/L (GLUC 2023/12/29 06:05 SN:PMA231223000006 )';
+        //尿酸,16秒
+        $str = '  381umol/L ( UA  2023/12/29 06:21 SN:PMA231223000006 )';
+        //胆总,26秒
+        $str = ' 3.91mmol/L (CHOL 2023/12/29 06:25 SN:PMA231223000006 )';
+    }
 }