vali 6 سال پیش
والد
کامیت
5cd200f85b

+ 2 - 2
app/Http/Controllers/Admin/GmenuController.php

@@ -61,7 +61,7 @@ class GmenuController extends PublicController
      */
     public function store(Request $request)
     {
-        $data = $request->only(['parent_id','gname','sort','gaction','status','iconUrl','isleaf']);
+        $data = $request->only(['parent_id','gname','sort','gaction','status','iconUrl','isleaf','smalliconUrl']);
         $data['status'] = (trim($data['status']==1)) ? 1 : 0 ;
         $data['isleaf'] = (trim($data['isleaf'])==1) ? 1 : 0 ;
 
@@ -91,7 +91,7 @@ class GmenuController extends PublicController
     public function update(Request $request, $id)
     {
         $gmenu = Gmenu::findOrFail($id);
-        $data =  $request->only('gname','parent_id','sort','iconUrl','gaction','status','isleaf');
+        $data =  $request->only('gname','parent_id','sort','iconUrl','gaction','status','isleaf','smalliconUrl');
         $data['status'] = (trim($data['status'])==1) ? 1 : 0 ;
         $data['isleaf'] = (trim($data['isleaf'])==1) ? 1 : 0 ;
 

+ 28 - 4
resources/views/admin/gmenu/_form.blade.php

@@ -22,9 +22,16 @@
 </div>
 
 <div class="layui-form-item">
-    <label for="" class="layui-form-label">图标URL</label>
+    <label for="" class="layui-form-label">图标URL</label>
     <div class="layui-input-inline">
-        <input type="text" name="iconUrl" id="iconUrl" value="{{ $gmenu->iconUrl ?? old('iconUrl') }}" lay-verify="required"  placeholder="图标URL" class="layui-input">
+        <input type="text" name="iconUrl" id="iconUrl" value="{{ $gmenu->iconUrl ?? old('iconUrl') }}" lay-verify="required"  placeholder="大图标URL" class="layui-input">
+    </div>
+</div>
+
+<div class="layui-form-item">
+    <label for="" class="layui-form-label">小图标URL</label>
+    <div class="layui-input-inline">
+        <input type="text" name="smalliconUrl" id="smalliconUrl" value="{{ $gmenu->smalliconUrl ?? old('smalliconUrl') }}" lay-verify="required"  placeholder="小图标URL" class="layui-input">
     </div>
 </div>
 
@@ -53,10 +60,10 @@
 
 
 <div class="layui-form-item">
-    <label for="" class="layui-form-label">图片上传</label>
+    <label for="" class="layui-form-label">大图标上传</label>
     <div class="layui-input-block">
         <div class="layui-upload">
-            <button type="button" class="layui-btn" id="uploadPic"><i class="layui-icon">&#xe67c;</i>图片上传</button>
+            <button type="button" class="layui-btn" id="uploadPic"><i class="layui-icon">&#xe67c;</i>图片上传</button>
             <div class="layui-upload-list" >
                 <ul id="layui-upload-box" class="layui-clear">
                     @if(isset($gmenu->iconUrl))
@@ -69,6 +76,23 @@
     </div>
 </div>
 
+<div class="layui-form-item">
+    <label for="" class="layui-form-label">小图标上传</label>
+    <div class="layui-input-block">
+        <div class="layui-upload">
+            <button type="button" class="layui-btn" id="uploadPicSmall"><i class="layui-icon">&#xe67c;</i>小图片上传</button>
+            <div class="layui-upload-list" >
+                <ul id="layui-upload-box-samll" class="layui-clear">
+                    @if(isset($gmenu->smalliconUrl))
+                        <li><img src="{{ $gmenu->smalliconUrl }}" /><p>上传成功</p></li>
+                    @endif
+                </ul>
+                <input type="hidden" name="smallUpiconUrl" id="smallUpiconUrl" value="{{ $gmenu->smalliconUrl??'' }}">
+            </div>
+        </div>
+    </div>
+</div>
+
 
 <div class="layui-form-item">
     <div class="layui-input-block">

+ 71 - 0
resources/views/admin/gmenu/_js.blade.php

@@ -35,6 +35,49 @@
         z-index:999;
         cursor: pointer;
     }
+
+
+
+
+
+
+    #layui-upload-box-samll li{
+        width: 120px;
+        height: 100px;
+        float: left;
+        position: relative;
+        overflow: hidden;
+        margin-right: 10px;
+        border:1px solid #ddd;
+    }
+    #layui-upload-box-samll li img{
+        width: 100%;
+    }
+    #layui-upload-box-samll li p{
+        width: 100%;
+        height: 22px;
+        font-size: 12px;
+        position: absolute;
+        left: 0;
+        bottom: 0;
+        line-height: 22px;
+        text-align: center;
+        color: #fff;
+        background-color: #333;
+        opacity: 0.6;
+    }
+    #layui-upload-box-samll li i{
+        display: block;
+        width: 20px;
+        height:20px;
+        position: absolute;
+        text-align: center;
+        top: 2px;
+        right:2px;
+        z-index:999;
+        cursor: pointer;
+    }
+
 </style>
 <script>
     layui.use(['upload'],function () {
@@ -65,5 +108,33 @@
                 return layer.msg(res.msg,{icon:5});
             }
         });
+
+        var upload_2 = layui.upload
+        var uploadInstsmall = upload_2.render({
+            elem: '#uploadPicSmall'
+            ,url: '{{ route("admin.uploadImg") }}'
+            ,multiple: false
+            ,data:{"_token":"{{ csrf_token() }}"}
+            ,before: function(obj){
+                //预读本地文件示例,不支持ie8
+                /*obj.preview(function(index, file, result){
+                 $('#layui-upload-box').append('<li><img src="'+result+'" /><p>待上传</p></li>')
+                 });*/
+                obj.preview(function(index, file, result){
+                    $('#layui-upload-box-samll').html('<li><img src="'+result+'" /><p>上传中</p></li>')
+                });
+
+            }
+            ,done: function(res){
+                //如果上传失败
+                if(res.code == 0){
+                    $("#smalliconUrl").val(res.url);
+                    $('#layui-upload-box-samll li p').text('上传成功');
+                    return layer.msg(res.msg,{icon:6});
+                }
+                return layer.msg(res.msg,{icon:5});
+            }
+        });
+
     });
 </script>

+ 2 - 1
resources/views/admin/gmenu/index.blade.php

@@ -74,7 +74,8 @@
                         ,{field: 'created_at', title: '创建时间'}
                         ,{field: 'updated_at', title: '更新时间'}
                         ,{field: 'status', title: '状态'}
-                        ,{field: 'iconUrl', title: '图片URL', templet:function (d) { if ( d.iconUrl==null || d.iconUrl=='')  { return '';}else{ return '<a href="'+d.iconUrl+'" target="_blank"><img src="'+d.iconUrl+'"></a>'; }} }
+                        ,{field: 'iconUrl', title: '大图URL', templet:function (d) { if ( d.iconUrl==null || d.iconUrl=='')  { return '';}else{ return '<a href="'+d.iconUrl+'" target="_blank"><img src="'+d.iconUrl+'"></a>'; }} }
+                        ,{field: 'smalliconUrl', title: '小图URL', templet:function (d) { if ( d.smalliconUrl==null || d.iconUrl=='')  { return '';}else{ return '<a href="'+d.smalliconUrl+'" target="_blank"><img src="'+d.smalliconUrl+'"></a>'; }} }
                         ,{field: 'gaction', title: '目标'}
                         ,{field: 'isleaf', title: '节点'}
 

+ 11 - 11
websockServ/app/lib/DB_pool.php

@@ -38,10 +38,10 @@ class DB_pool
     {
         $this->host = $config['poole_host'] ? $config['poole_host'] : "127.0.0.1"; // server监听的端口
         $this->server_port = $config['poole_port'] ? $config['poole_port'] : 9091;  // server监听的端口
-        $this->worker_num = 5;
-        $this->task_worker_num = 5;
+        $this->worker_num = 2;
+        $this->task_worker_num = 2;
         $this->dispatch_mode = 2;
-        $this->daemonize = true ;
+        $this->daemonize = true;
         $this->max_request = 10000;
         $filename = date("Ymd", time());
         $this->log_file = "../logs/DB_pool_err_" . $filename . '.log';
@@ -87,11 +87,11 @@ class DB_pool
     {
         $resultStr = $this->serv->taskwait($data);
         if ($resultStr !== false) {
-            $this->serv->send($fd, $resultStr );
-            return ;
+            $this->serv->send($fd, $resultStr);
+            return;
             $result = json_decode($resultStr, true);
             if (isset($result['status']) && $result['status'] == 'success') {
-                $this->serv->send($fd, $resultStr );
+                $this->serv->send($fd, $resultStr);
             } else {
                 $this->serv->send($fd, $resultStr);
             }
@@ -120,20 +120,20 @@ class DB_pool
         }
 
         $sql = trim($sql);
-        if (preg_match("/^select/i", $sql)){
+        if (preg_match("/^select/i", $sql)) {
             $result = $link->query($sql);
-        }else{
+        } else {
             $result = $link->exec($sql);
         }
 
-        $data = ['status'=>false] ;
+        $data = ['status' => false];
         if (!$result) { //如果查询失败了
             if (in_array($link->errorCode(), [2013, 2006])) {//错误码为2013,或者2006,则重连数据库,重新执行sql
                 $link = null;
                 goto HELL;
             }
             $errinfoArr = $link->errorInfo();
-            if (!($errinfoArr['0']=='00000' && $errinfoArr['1'] =='' &&  $errinfoArr['2']=='')){
+            if (!($errinfoArr['0'] == '00000' && $errinfoArr['1'] == '' && $errinfoArr['2'] == '')) {
                 $data['status'] = 'false';
                 $data['data'] = $link->errorInfo();
                 $this->serv->finish(json_encode($data, 256));
@@ -142,7 +142,7 @@ class DB_pool
         }
         if (preg_match("/^select/i", $sql)) { //如果是select操作,就返回关联数组
             $dataRet = $result->fetchAll(\PDO::FETCH_CLASS);
-            $data['data'] = $dataRet ;
+            $data['data'] = $dataRet;
         } else {//否则直接返回结果
             $data['data'] = $result;
         }

+ 0 - 27
websockServ/app/lib/Wlog.php

@@ -87,34 +87,7 @@ class Wlog
             file_put_contents($fullName,$msg."\r\n",FILE_APPEND);
             return true;
         });
-        /*
-        $msg = json_encode([date("Y-m-d H:i:s"), $msg], 256);
 
-        if (in_array($type, [1, 2])) {
-            $redis = $this->GetRedis();
-            if ($redis) {
-                if ($type == 1) {
-                    $minit = date("i");
-                    $ktype = RUN_LOGS_OVTIME_KEY . '_' . $minit;
-                    $key = $ktype . ":" . $worker_id . '_' . $this->IncrKey();
-                    $otime = RUN_LOGS_OVTIME;
-                    $redis->hset($ktype, $key, $msg);
-                    $redis->expire($ktype, $otime);
-                } else {
-                    $ktype = RUN_LOGS_OVTIME_KEY;
-                    $redis->lpush($ktype, $msg);
-                }
-                return true;
-            }
-        }
-
-        //redis 失败时,写到日志文件中
-        $fileName = date("Y-m-d") . '.log';
-        $fullName = LOG_PATH . DS . $fileName;
-        swoole_async_writefile($fullName, $msg . "\r\n", null, FILE_APPEND);
-
-        return true;
-        */
     }
 
     public function IncrKey()

+ 3 - 0
websockServ/app/lib/boot.php

@@ -1,6 +1,9 @@
 <?php
 namespace  app\lib;
+ini_set('date.timezone','Asia/Shanghai');
+ini_set('memory_limit', '256M');
 /**
+ *
  * Created by PhpStorm.
  * User: Administrator
  * Date: 2019/5/20

+ 49 - 101
websockServ/app/logic/MyServerV2.php

@@ -14,7 +14,6 @@ use app\lib\GlobConfigs;
 use Illuminate\Database\Capsule\Manager as Capsule;
 use Illuminate\Database\Capsule\Manager as DB;
 use  app\lib\Wlog;
-use app\logic\MyPgsql as MyPgsql;
 
 class MyServerV2
 {
@@ -22,7 +21,6 @@ class MyServerV2
 
     //线程连接实例
     private $workRedis = null;
-    private $workMysql = null;
     private $workPgsql = null;
 
     public function __construct()
@@ -69,12 +67,6 @@ class MyServerV2
                 $this->PingRedis($serv, $worker_id);
             });
 
-            /*
-            $this->PingMysql($serv, $worker_id);
-            $serv->tick(5000, function () use ($serv, $worker_id) {
-                $this->PingMysql($serv, $worker_id);
-            });
-            */
             $this->PingPgsql($serv, $worker_id);
             $serv->tick(5000, function () use ($serv, $worker_id) {
                 $this->PingPgsql($serv, $worker_id);
@@ -87,50 +79,6 @@ class MyServerV2
                 TimeRsync::getInstance()->DoTimePublic($serv, $worker_id, $this->workRedis);
             });
 
-            MyPgsql::getInstance();
-
-            //消息订阅
-            if ($worker_id == 0) {
-
-                if (!$worker_id) {
-                    return;
-                }
-
-                go(function () use ($serv, $worker_id) {
-                    $config = GlobConfigs::getKey('redis');
-                    $redis = new \Swoole\Coroutine\Redis();
-                    $redis->setOptions(['compatibility_mode' => true]);
-                    $redis->connect($config['host'], $config['port']);
-                    $r = $redis->SUBSCRIBE([MSG_REDIS_SUBSCRIBE, 'TEST']);
-                    if ($r) {
-                        while ($msg = $redis->recv()) {
-                            print_r($msg);
-                            // msg是一个数组, 包含以下信息
-                            // $type # 返回值的类型:显示订阅成功
-                            // $name # 订阅的频道名字 或 来源频道名字
-                            // $info  # 目前已订阅的频道数量 或 信息内容
-                            list($type, $name, $info) = $msg;
-                            if ($type == 'subscribe') // 或psubscribe
-                            {
-                                // 频道订阅成功消息,订阅几个频道就有几条
-                            } else if ($type == 'unsubscribe' && $info == 0) // 或punsubscribe
-                            {
-                                break; // 收到取消订阅消息,并且剩余订阅的频道数为0,不再接收,结束循环
-                            } else if ($type == 'message') // 若为psubscribe,此处为pmessage
-                            {
-                                /*
-                                if ($need_unsubscribe) // 某个情况下需要退订
-                                {
-                                    $redis->unsubscribe(); // 继续recv等待退订完成
-                                }
-                                */
-                            }
-                        }
-
-
-                    }
-                });
-            }
         }
     }
 
@@ -140,16 +88,13 @@ class MyServerV2
         if ($this->workRedis) {
             $this->workRedis->close();
         }
-        if ($this->workMysql) {
-            $this->workMysql->close();
-        }
     }
 
 
     public function onMessage($serv, $frame)
     {
-        if (strtolower($frame->data->data) == '{"type":"ping"}') {
-            $serv->send($frame->fd, '{"type":"pong"}');
+        if (strtolower($frame->data) == strtolower('{"type":"ping"}')) {
+            $serv->push($frame->fd, '{"type":"pong"}');
             return;
         }
         Wlog::getInstance()->WriteLog($frame);
@@ -158,16 +103,26 @@ class MyServerV2
 
     public function onOpen($serv, $request)
     {
-        //Wlog::getInstance()->WriteLog(['onOpenData', $request]);
+        $config = GlobConfigs::getKey('swoole');
+        if (count($serv->connections) > $config['maxUsers']) {
+            $serv->push($request->fd, DataPack::toJson(['mtype' => 'system_msg', 'stype' => 'maxUsers', 'data' => '超过人数上限']));
+            $serv->disconnect($request->fd);
+            return;
+        }
+
         $token = isset($request->get['token']) ? $request->get['token'] : '';
         //$uid = isset($request->get['uid']) ? $request->get['uid'] : '';
         $fd = $request->fd;
         $redis = $this->workRedis;
         if (!$redis) {
+            $serv->push($request->fd, DataPack::toJson(['mtype' => 'system_msg', 'stype' => 'error', 'data' => ['msg' => '服务端错误!-01']]));
+            $serv->disconnect($request->fd);
             return;
         }
+
         $token_uid = $uid = intval($this->workRedis->hget(MAPS_TOKEN_UID, md5($token)));
-        if (empty($token) || !$token_uid) {
+        echo '新请求uid-'.$token_uid.' fd-'.$fd.' 接入....'."\n";
+        if (empty($token) || empty($token_uid) || $token_uid == '' || $token_uid == 0) {
             $serv->push($request->fd, DataPack::toJson(['mtype' => 'system_msg', 'stype' => 'invalid_token', 'data' => ['msg' => '无效的token']]));
             $serv->disconnect($request->fd);
             return;
@@ -186,10 +141,18 @@ class MyServerV2
             $this->workRedis->hset(MAPS_FID_UID, $fd, $uid);
             $serv->ftable->set($fd, ['uid' => $uid]);
             $serv->utable->set($uid, ['fid' => $fd]);
+        } else {
+            if (!$this->admin_ip_Check($request->server['remote_addr'], $adminconfig['whiteips'])) {
+                $serv->push($request->fd, DataPack::toJson(['mtype' => 'system_msg', 'stype' => 'force_logout', 'data' => ['msg' => '登陆被限!' . $request->server['remote_addr']]]));
+                $serv->disconnect($request->fd);
+                return;
+            }
+            $this->workRedis->hset(MAPS_FID_UID, $fd, $uid);
+            $serv->ftable->set($fd, ['uid' => $uid]);
         }
 
-
-        $serv->push($fd, DataPack::toJson(['mtype' => 'system_msg', 'stype' => 'well_come', 'data' => ['msg' => '成功接入']]));
+        $msg = '成功接入 [' . $request->server['remote_addr'] . ' - ' . $fd . ' - ' . $uid . "]";
+        $serv->push($fd, DataPack::toJson(['mtype' => 'system_msg', 'stype' => 'well_come', 'data' => ['msg' => $msg]]));
     }
 
     public function onTask($serv, \Swoole\Server\Task $task)
@@ -217,6 +180,9 @@ class MyServerV2
 
             $serv->ftable->del($fd);
             $serv->utable->del($uid);
+        } else {
+            $this->workRedis->hdel(MAPS_FID_UID, $fd);
+            $serv->ftable->del($fd);
         }
         echo "ClientFd:{$fd} -- uid:{$uid} close connection!\n";
     }
@@ -265,43 +231,6 @@ class MyServerV2
         return false;
     }
 
-    //Mysql Ping检测
-    private function PingMysql($serv, $worker_id)
-    {
-        if (empty($this->workMysql)) {
-            $this->ConectToMysql($serv, $worker_id);
-            return true;
-        }
-        $mysql = $this->workMysql;
-        if (!$mysql) {
-            $ping_ret = false;
-        } else {
-            $ping_ret_s = DB::select("select version() as v");
-            $ping_ret = !empty($ping_ret_s) ? true : false;
-        }
-
-        if (!$ping_ret) {
-            return $this->ConectToMysql($serv, $worker_id);
-        }
-        return true;
-    }
-
-    //工作线程 同步阻塞 Mysql 客户端
-    private function ConectToMysql($serv, $worker_id)
-    {
-        $conf = GlobConfigs::getKey('mysql');
-        $mysql = new Capsule();
-        $mysql->addConnection($conf);
-        $mysql->setAsGlobal();
-        $mysql->bootEloquent();
-
-        Wlog::getInstance()->WriteLog("success:成功建立Mysql连接 " . date("Y-m-d H:i:s") . ' ' . $worker_id);
-        $this->workMysql = $mysql;
-        return $mysql;
-
-    }
-
-
     //Mysql Ping检测
     private function PingPgsql($serv, $worker_id)
     {
@@ -359,10 +288,29 @@ class MyServerV2
         }
     }
 
-    //redis推送消息
-    private function MsgRedisList($serv, $worker_id)
+    //admin ip check
+    private function admin_ip_Check($ip, $okipArray = [])
     {
-
+        if (empty($okipArray)) {
+            return false;
+        }
+        foreach ($okipArray as $aip) {
+            if ($ip === $aip) {
+                return true;
+            }
+            $spos = strpos($aip, "*");
+            if ($spos === false) {
+                continue;
+            } else {
+                for ($i = 0; $i < $spos; $i++) {
+                    if ($ip[$i] != $aip[$i]) {
+                        continue;
+                    }
+                }
+                return true;
+            }
+        }
+        return false;
     }
 
 

+ 16 - 11
websockServ/app/logic/SubServer.php

@@ -56,7 +56,7 @@ class SubServer
         });
 
         if ($worker_id == 0) {
-            $serv->tick(1000, function () use ($serv, $worker_id) {
+            $serv->tick(500, function () use ($serv, $worker_id) {
                 $msg_index_aray = $this->getBoardMsg();
                 if (!empty($msg_index_aray)) {
                     $this->SendMsgComm('msg_board', $msg_index_aray);
@@ -65,15 +65,14 @@ class SubServer
         }
 
         if ($worker_id == 1) {
-            $serv->tick(1000, function () use ($serv, $worker_id) {
+            $serv->tick(500, function () use ($serv, $worker_id) {
                 $msg_user_array = $this->getSingMsg();
                 if (!empty($msg_user_array)) {
                     $this->SendMsgComm('msg_to_one_user', $msg_user_array);
-                    //$this->sendSingMsg($msg_user_array);
                 }
             });
         }
-        
+
         if ($worker_id == 2) {
             $serv->tick(5000, function () use ($serv, $worker_id) {
                 $msg_tick_array = $this->getDoTick();
@@ -83,7 +82,6 @@ class SubServer
             });
         }
 
-
     }
 
     function onWorkerStop(swoole_server $server, int $worker_id)
@@ -161,13 +159,16 @@ class SubServer
     {
         $redis = $this->workRedis;
         $len = $redis->LLEN(MSG_BOARD);
+        $i = 0;
 
         if ($len <= 0) {
             return;
         }
         $datas = [];
         while ($now = $redis->rpop(MSG_BOARD)) {
-            if (empty($now)) {
+
+            if (empty($now) || $i >= 100) {
+                $i = 0;
                 break;
             }
             $now = json_decode($now, true);
@@ -181,7 +182,7 @@ class SubServer
             }
             $datas[] = $now;
         }
-
+        $i++;
         return $datas;
     }
 
@@ -190,14 +191,15 @@ class SubServer
     {
         $redis = $this->workRedis;
         $len = $redis->LLEN(MSG_TO_ONE_USER);
-
+        $i = 0;
         if ($len <= 0) {
             return;
         }
 
         $datas = [];
         while ($now = $redis->rpop(MSG_TO_ONE_USER)) {
-            if (empty($now)) {
+            if (empty($now) || $i >= 500) {
+                $i = 0;
                 break;
             }
             $now = json_decode($now, true);
@@ -228,6 +230,7 @@ class SubServer
             $now['confirm'] = (isset($now['confirm']) && $now['confirm'] == 1) ? 1 : 0;
 
             $datas[] = $now;
+            $i++;
         }
         return $datas;
     }
@@ -236,14 +239,15 @@ class SubServer
     {
         $redis = $this->workRedis;
         $len = $redis->LLEN(DO_TICK_USER);
-
+        $i = 0;
         if ($len <= 0) {
             return;
         }
 
         $datas = [];
         while ($now = $redis->rpop(DO_TICK_USER)) {
-            if (empty($now)) {
+            if (empty($now) || $i >= 100) {
+                $i = 0;
                 break;
             }
             $allArray = json_decode($now, true);
@@ -261,6 +265,7 @@ class SubServer
                 }
                 $datas[] = $one;
             }
+            $i++;
         }
         return $datas;
     }

+ 4 - 3
websockServ/commands/clientws2.php

@@ -15,7 +15,8 @@ require __DIR__.'/../vendor/autoload.php';
 
 use WebSocket\Client as Client;
 
-$url = "?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJib3JuIiwiaWF0IjoxNTU5MDI3Mzk1LCJleHAiOjE1NTkwMzQ1OTUsIm5iZiI6MTU1OTAyNzQ1NSwic3ViIjoxMCwianRpIjoiOGVlODI5Y2QtNjM3Mi1iNjUyLTYxYWItMWY3YWViYTNhODM0In0.eLuHFc5uhTAc87DVCAnTKzRloZS0n79jYWTYE9ea7E0";
+$conf = \app\lib\GlobConfigs::getKey('admin_conf');
+$url = "?token=".$conf['admin_token'];
 $client = new Client("ws://192.168.2.200:9090/".$url);
 
 
@@ -26,12 +27,12 @@ $msg = $client->receive();
 echo "Recive: ".$msg."\n\n\n";
 $msg = $client->receive();
 echo "Recive: ".$msg."\n\n\n";
-sleep(1);
+sleep(3);
 
 $r = $client->send($str);
 $msg = $client->receive();
 echo "Recive: ".$msg."\n\n\n";
-sleep(1);
+sleep(3);
 
 $r = $client->send($str);
 $msg = $client->receive();

+ 13 - 25
websockServ/configs/configs.php

@@ -8,17 +8,6 @@
 
 $tmp_config = [
     'common' => [
-        'mysql' => [
-            'driver' => 'mysql',
-            'host' => '192.168.2.200',
-            'port' => 3306,
-            'database' => 'ds_cms',
-            'username' => 'vali',
-            'user' => 'vali',
-            'password' => '1234',
-            'charset' => 'utf8mb4',
-            'collation' => 'utf8mb4_unicode_ci'
-        ],
         'pgsql' => [
             'driver' => 'pgsql',
             'host' => '192.168.2.200',
@@ -43,7 +32,7 @@ $tmp_config = [
         'swoole' => [
             'host' => '0.0.0.0',
             'port' => '9090',
-            'maxUsers' => 4096,
+            'maxUsers' => 50000,
             'sets' => [
                 'worker_num' => 2,
                 'daemonize' => true,
@@ -83,29 +72,28 @@ $tmp_config = [
             'db_user' => 'kaiyou',
             'db_pwd' => '123456',
         ],
-        //数据库代理配置--mysql
-        'mysqlpoole' => [
-            'poole_host' => '0.0.0.0',
-            'poole_port' => 9091,
-
-            'db_type' => 'mysql',
-            'db_host' => '192.168.2.200',
-            'db_port' => 3306,
-            'db_name' => 'ds_cms',
-            'db_user' => 'vali',
-            'db_pwd' => '1234',
-        ],
 
         //管理员使用的
         'admin_conf' => [
             'url' => 'ws://192.168.2.200:9090',
             'admin_uid' => 999999999,
+            'whiteips' =>['172.17.0.*','127.0.0.1'],
             'md5' => '70d8d42d4307e63702b25ddef0129f72',
             'admin_token' => 'aaminaeyJhb34G6i6JIU6I1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJib3JuIiwiaWF0IjoxNTU4NTk1MjgxLCJleHAiOjE1NTg2MDI0ODEsIm5iZiI6MTU1ODU5NTM0MSwic3ViIjo3NiwianRpIjoiNWIwYjlkNjMtYmQ5My1kNTBkLTA1NzgtZGU0NDEyYjFmZjBlIn0.jaYz1IcJJxNCaEF-ELCcE6JjbFSjKPl0p-whJ76dV1w',
         ],
     ],
     'dev' => [
-
+        'mysql' => [
+            'driver' => 'mysql',
+            'host' => '192.168.2.200',
+            'port' => 3306,
+            'database' => 'ds_cms',
+            'username' => 'vali',
+            'user' => 'vali',
+            'password' => '1234',
+            'charset' => 'utf8mb4',
+            'collation' => 'utf8mb4_unicode_ci'
+        ],
     ],
     'test' => [