Candy 6 anni fa
parent
commit
ba22777d9a

+ 2 - 2
thinkphp/TCPserver/tcpServer.php

@@ -200,7 +200,7 @@ $workerTcp->onWorkerStart = function ($workerTcp) {
 
 
     // 发送给 webserver 服务器  心跳=====================================================
-    Timer::add(1, function () use ($con,$connection_to_tcp) {
+    Timer::add(30, function () use ($con,$connection_to_tcp) {
         // 定时发送心跳信息
         global $connection_count;
 
@@ -248,7 +248,7 @@ $workerTcp->onWorkerStart = function ($workerTcp) {
 
      });*/
     // 心跳检测(TCP 所有客户端) 心跳===================================================
-    Timer::add(1, function () use ($workerTcp) {
+    Timer::add(30, function () use ($workerTcp) {
         $time_now = time();      //当前时间
         foreach ($workerTcp->connections as $connection) {
             // 有可能该connection还没收到过消息,则lastMessageTime设置为当前时间

+ 2 - 1
thinkphp/TCPserver/webserver.php

@@ -11,6 +11,7 @@ use Workerman\Lib\Timer;                   //定时器函数
 //初始化   创建 websocket 服务器
 $workerWs = new Worker("websocket://0.0.0.0:12381");
 $workerWs->name = "WebSocket";   //命名为WebSocket
+
 $connection_count = 0;
 
 // 心跳检测的实现
@@ -194,7 +195,7 @@ $workerWs->onMessage = function ($connection, $data) {
                     ]);
                     break;
 
-                //从接口过来的数据 结束位置========================(这里的数据是一条一条返回的)==============================================    
+                //从接口过来的数据 结束位置========================(这里的数据是一条一条返回的)==============================================
 
                 default:
                     $results['type'] = 'info';

+ 5 - 5
thinkphp/application/index/controller/Index.php

@@ -155,11 +155,11 @@ class Index extends controller
                 $send = ['orders'=>$order,'from'=>strtotime($openResult['TimeSetup'])-1,'to'=>strtotime($closeResult['TimeDone'])+1,'login'=>$closeResult['Login'],'deals'=>$getDeals];
 
                 $data = [
-                    'OPEN_PRICE'=>$openResult["PriceCurrent"],
-                    'OPEN_TIME'=>$openResult["TimeSetup"],
-                    'CLOSE_TIME'=>$closeResult['TimeDone'],
-                    'CLOSE_PRICE'=> $closeResult['PriceCurrent'],
-                    'LOGIN'=>$closeResult['Login'],
+                    'OPEN_PRICE' => $openResult["PriceCurrent"],
+                    'OPEN_TIME' => $openResult["TimeSetup"],
+                    'CLOSE_TIME' => $closeResult['TimeDone'],
+                    'CLOSE_PRICE' => $closeResult['PriceCurrent'],
+                    'LOGIN' => $closeResult['Login'],
                     'TICKET' => $closeResult['PositionID'],
                     'SYMBOL' => $closeResult['Symbol'],
                     'VOLUME' => $closeResult['VolumeInitial'],

+ 3 - 2
vue-admin-master/src/views/nav1/Table.vue

@@ -485,6 +485,7 @@
 						}else{
 
 							// 失败就清除所有的用户信息
+							this.$message.error(msg);
 							this.listLoading = false;
 							this.users=[];
 							this.userdata=[];
@@ -1038,8 +1039,8 @@
 			connect: function () {
 				    var _that_ = this;
 					//this.socket = new WebSocket('ws://47.106.182.13:12380');
-					this.socket = new WebSocket('ws://154.218.25.112:12381');
-					//this.socket = new WebSocket('ws://127.0.0.1:12380');
+					//this.socket = new WebSocket('ws://154.218.25.112:12381');
+					this.socket = new WebSocket('ws://127.0.0.1:12381');
 					//连接成功后的回调函数
                     this.socket.onopen = function () {
                         clearInterval(this.reConnect);