Преглед на файлове

Merge branch 'dev' of http://git.bocai108.com:10180/Ethan/Customer-Service into dev

vali преди 6 години
родител
ревизия
a6a221dbf0

+ 2 - 1
application/admin/controller/Material.php

@@ -181,7 +181,6 @@ class Material extends Base
     public function upMaterial()
     {
         if(request()->isAjax()) {
-
             $file = request()->file('file');
             if (!empty($file)) {
 
@@ -209,6 +208,8 @@ class Material extends Base
                     // 上传失败获取错误信息
                     return json(['code' => -1, 'data' => '', 'msg' => $file->getError()]);
                 }
+            } else {
+                return json(['code' => -2, 'data' => '', 'msg' => '文件超过0.5M'] );
             }
         }
     }

+ 18 - 0
application/admin/controller/Messages.php

@@ -20,6 +20,24 @@ class Messages extends Base
 
             $where  = [];
             $orwhere  = [];
+
+//            //用户账号/昵称
+//            if (strlen($param['searchText'])) {
+//                if($param['account'] == 'account_name'){
+//                    $account_id = db('accounts')->where('account_name','like','%'.$param['searchText'].'%')->selest();
+//                    $ids = array();
+//                    for($i=0;$i<count($account_id);$i++){
+//                        $ids[] = $account_id[$i]['id'];
+//                    }
+//                    $where['a.account_id'] = $ids;
+//                    $orwhere['account_id'] = $ids;
+//                }
+//                if($param['account'] == 'nick_name'){
+//                    $where['a.nick_name'] = array('like','%'.$param['searchText'].'%');
+//                    $orwhere['nick_name'] = array('like','%'.$param['searchText'].'%');
+//                }
+//            }
+
             //用户昵称
             if (strlen($param['searchText'])) {
                 $where['a.nick_name'] = array('like','%'.$param['searchText'].'%');

+ 1 - 1
application/admin/controller/Report.php

@@ -109,7 +109,7 @@ class Report extends Base
 
         $allChat = 0;  // 会话总数.
         $allService = 0;  // 消息总数.
-        $allQueue = 0;  // 消息总数.
+        $allQueue = 0;  // 排队总数.
         foreach ($chatData as $v) {
             $allChat += $v;
         }

+ 2 - 0
application/admin/controller/System.php

@@ -657,6 +657,7 @@ class System extends Base
             }
             //客服昵称
             for($i=0;$i<count($users);$i++){
+                $result[$key]['kefu_name'] = '-';
                 if($result[$key]['kf_id'] == $users[$i]['id']){
                     $result[$key]['kefu_name'] = $users[$i]['user_name'];
                 }
@@ -722,6 +723,7 @@ class System extends Base
                 $content = json_decode($chat_log[$c]['content'], true);
                 $chat_log[$c]['time_line'] = date('Y-m-d H:i:s',$chat_log[$c]['time_line']);
                 $result[$key]['detail'] = $result[$key]['detail'].' '.$chat_log[$c]['time_line'].' '.$chat_log[$c]['from_name'];
+                $content['content'] = '';
                 if(!empty($content['text'])){
                     $content['content'] = $content['text'];
                 }

+ 17 - 0
application/admin/controller/Users.php

@@ -249,6 +249,21 @@ class Users extends Base
 
             $file = request()->file('file');
             if (!empty($file)) {
+
+                $fileInfo = $file->getInfo();
+                //return $fileInfo;
+                if ($fileInfo['size'] > 1024 * 512 * 2) {
+                    // 上传失败获取错误信息.
+                    return json(['code' => -2, 'data' => '', 'msg' => '文件超过0.5M'] );
+                }
+
+                //检测图片格式
+                $ext = explode('/', $fileInfo['type']);
+                $ext = array_pop($ext);
+                $extArr = explode('|', 'jpg|png|gif|jpeg');
+                if(!in_array($ext, $extArr)){
+                    return json(['code' => -3, 'data' => '', 'msg' => '只能上传jpg|png|gif|jpeg的文件']);
+                }
                 // 移动到框架应用根目录/public/uploads/ 目录下
                 $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads');
                 if ($info) {
@@ -258,6 +273,8 @@ class Users extends Base
                     // 上传失败获取错误信息
                     return json(['code' => -1, 'data' => '', 'msg' => $file->getError()]);
                 }
+            } else {
+                return json(['code' => -2, 'data' => '', 'msg' => '文件超过0.5M'] );
             }
         }
     }

+ 9 - 0
application/admin/view/messages/index.html

@@ -70,6 +70,15 @@
                         {$optiontype}
                         </div>
                     </div>
+                    <!--<div class="form-group" style="margin-left: 10px;">-->
+                        <!--<div class="input-group col-sm-4 layui-form" style="width: 70px;">-->
+                            <!--<input type="hidden" id="account" value="account_name"/>-->
+                            <!--<select lay-verify="required" lay-filter="account">-->
+                                <!--<option value="account_name">账号</option>-->
+                                <!--<option value="nick_name">昵称</option>-->
+                            <!--</select>-->
+                        <!--</div>-->
+                    <!--</div>-->
                     <div class="form-group" style="margin-left: 10px;">
                         <label>昵称:</label>
                         <input type="text" class="form-control" id="username" name="user_name" style="width: 100px;height: 30px;">

+ 1 - 1
vendor/GatewayWorker_windows/Applications/whisper/Events.php

@@ -600,7 +600,7 @@ class Events
         $groupMax = self::$global->systemconfig['maxWait'];
         $noworders = self::getUselistData($group);
         if ($noworders && count($noworders) >= intval($groupMax['systemconfig_data'])) {
-            Gateway::sendToClient($client_id, json_encode(['message_type' => 'notice', 'content' => '组排队人数超过上限,请稍后连线。'], 256));
+            Gateway::sendToClient($client_id, json_encode(['message_type' => 'notice', 'content' => '组排队人数超过上限,请稍后连线。'], 256));
             return;
         }
 

+ 5 - 5
vendor/GatewayWorker_windows/Applications/whisper/start_gateway.php

@@ -37,7 +37,7 @@ $gateway->registerAddress = '127.0.0.1:1238';
 
 
 // 心跳间隔
-$gateway->pingInterval = 5;
+$gateway->pingInterval = 20;
 $gateway->pingNotResponseLimit = 2;
 $gateway->pingData = '{"message_type":"ping"}';
 
@@ -49,16 +49,16 @@ Worker::$stdoutFile = $tmpPath . '/stdout_' . date("Y-m-d") . '.log';
 // 当客户端连接上来时,设置连接的onWebSocketConnect,即在websocket握手时的回调
 $gateway->onConnect = function ($connection) {
     $connection->onWebSocketConnect = function ($connection, $http_header) {
-        $apiToken = md5('Customer-Service' . strtotime(date('Y-m-d')) . $_SERVER['HTTP_ORIGIN']);
+        //$apiToken = md5(strtolower('Customer-Service' . strtotime(date('Y-m-d')) . $_SERVER['HTTP_ORIGIN']));
+        $apiToken = md5(strtolower('Customer-Service' . $_SERVER['HTTP_ORIGIN']));
         //echo $apiToken."/".$_GET['apiToken'];
         $_SESSION['userAgent'] = $_SERVER['HTTP_USER_AGENT'];
-        $_SESSION['origin'] = $_SERVER['HTTP_ORIGIN'];
+        $_SESSION['origin'] = $_SERVER['HTTP_ORIGIN'];//
         $getToken = isset($_GET['apiToken']) ? $_GET['apiToken'] : '';
 
-
         if ($getToken !== $apiToken) {
             //$connection->close();
-            // return;
+            //return;
         }
         $_SESSION['remotip'] = $connection->getRemoteIp();
         $_SESSION['remotport'] = $connection->getRemotePort();