林琦海 пре 5 година
родитељ
комит
d9364c8395

+ 15 - 2
biz-ghs/ws/services/WsService.php

@@ -17,7 +17,14 @@ class WsService
             try{
                 $audio = base64_encode($audio);
                 $data = ['type' => 'money','url'=>'data:audio/mp3;base64,'.$audio, 'msg' => $msg,'money'=>$money];
-                Gateway::sendToUid($adminId, json_encode($data));
+                //判断是否在线
+                $online = Gateway::isUidOnline($adminId);
+                if($online){
+                    Gateway::sendToUid($adminId, json_encode($data));
+                }else{
+                    Yii::info("用户不在线:".$adminId);
+                }
+
             }catch (\Exception $exception){
                 Yii::warning("ws arrivalNotice error ". $exception->getMessage());
             }
@@ -41,7 +48,13 @@ class WsService
         ];
         Yii::info("触发订单通知:".$shopAdminId);
         try{
-            Gateway::sendToUid($shopAdminId, json_encode($data));
+            //判断是否在线
+            $online = Gateway::isUidOnline($shopAdminId);
+            if($online){
+                Gateway::sendToUid($shopAdminId, json_encode($data));
+            }else{
+                Yii::info("用户不在线:".$shopAdminId);
+            }
         }catch (\Exception $exception){
             Yii::warning("ws arrivalNotice error ". $exception->getMessage());
         }

+ 7 - 7
vendor/workerman/GatewayWorker/Applications/retail/start_gateway.php

@@ -23,13 +23,13 @@ require_once __DIR__ . '/../../vendor/autoload.php';
 // gateway 进程,这里使用Text协议,可以用telnet测试
 $context = [
     // 更多ssl选项请参考手册 http://php.net/manual/zh/context.ssl.php
-    'ssl' => array(
-        // 请使用绝对路径
-        'local_cert'                 => '/etc/letsencrypt/live/api.ghs.huaml.com/fullchain.pem', // 也可以是crt文件
-        'local_pk'                   => '/etc/letsencrypt/live/api.ghs.huaml.com/privkey.pem',
-        'verify_peer'                => false,
-        // 'allow_self_signed' => true, //如果是自签名证书需要开启此选项
-    )
+//    'ssl' => array(
+//        // 请使用绝对路径
+//        'local_cert'                 => '/etc/letsencrypt/live/api.ghs.huaml.com/fullchain.pem', // 也可以是crt文件
+//        'local_pk'                   => '/etc/letsencrypt/live/api.ghs.huaml.com/privkey.pem',
+//        'verify_peer'                => false,
+//        // 'allow_self_signed' => true, //如果是自签名证书需要开启此选项
+//    )
 
 ];
 $context = [];