Jelajahi Sumber

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

vali 6 tahun lalu
induk
melakukan
e88c9912de

+ 53 - 19
application/admin/controller/System.php

@@ -64,6 +64,59 @@ class System extends Base
     }//end basics()
 
 
+    /**
+     * 会话设置
+     *
+     * @access public
+     */
+    public function conversation()
+    {
+        // 表单提交.
+        if (request()->isPost()) {
+            $param = input('post.');
+
+            try {
+                // 修改会话超时.
+                $updateOvertimeData['systemconfig_data'] = $param['overtime'];
+                $updateOvertimeWhere['systemconfig_id']  = 1;
+                model('Systemconfig')->updateSystemconfig($updateOvertimeWhere, $updateOvertimeData);
+                // 修改访客静默.
+                $upUptdData['systemconfig_data'] = $param['unoperated'];
+                $upUptdWhere['systemconfig_id']  = 2;
+                model('Systemconfig')->updateSystemconfig($upUptdWhere, $upUptdData);
+                // 质检会话时长设置.
+                $upAllTimeData['systemconfig_data'] = $param['verifyAllTime'];
+                $upAllTimeWhere['systemconfig_id']  = 3;
+                model('Systemconfig')->updateSystemconfig($upAllTimeWhere, $upAllTimeData);
+                // 质检会话响应时长设置.
+                $upReturnTimeData['systemconfig_data'] = $param['verifyReturnTime'];
+                $upReturnTimeWhere['systemconfig_id']  = 4;
+                model('Systemconfig')->updateSystemconfig($upReturnTimeWhere, $upReturnTimeData);
+                // 满意度评价回合限制.
+                $upRoundData['systemconfig_data'] = $param['round'];
+                $upRoundWhere['systemconfig_id']  = 5;
+                model('Systemconfig')->updateSystemconfig($upRoundWhere, $upRoundData);
+
+                return json(['code' => 1, 'data' => '', 'msg' => '设置成功']);
+            } catch (\Exception $e) {
+                return json(['code' => -2, 'data' => '', 'msg' => $e->getMessage()]);
+            }//end try
+        }//end if
+
+        // 获取设置.
+        $systemconfig = model('Systemconfig')->selectSystemconfig();
+        $this->assign(
+            [
+                'systemconfig' => $systemconfig,
+                'status'       => config('kf_status'),
+            ]
+        );
+
+        return $this->fetch();
+
+    }//end conversation()
+
+
     // 自动回复设置
     public function reply()
     {
@@ -92,25 +145,6 @@ class System extends Base
         return $this->fetch();
     }
 
-    // 客服设置
-    public function customerService()
-    {
-        if(request()->isPost()){
-
-            $param = input('post.');
-            db('kf_config')->where('id', 1)->update($param);
-
-            return json(['code' => 1, 'data' => '', 'msg' => '设置成功']);
-        }
-
-        $this->assign([
-            'config' => db('kf_config')->where('id', 1)->find(),
-            'status' => config('kf_status')
-        ]);
-
-        return $this->fetch();
-    }
-
     // 历史会话记录
     public function wordsLog()
     {

+ 44 - 0
application/admin/model/Systemconfig.php

@@ -0,0 +1,44 @@
+<?php
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * 系统设置模型
+ */
+class Systemconfig extends Model
+{
+
+
+    /**
+     * 数据筛选
+     *
+     * @access public
+     * @param mixed $where 数据
+     * @return array 返回类型
+     */
+    public function selectSystemconfig()
+    {
+        $result = $this->order('systemconfig_id')->select();
+        return $result;
+
+    }//end selectSystemconfig()
+
+
+    /**
+     * 数据修改
+     *
+     * @access public
+     * @param mixed $data 数据
+     * @param mixed $where 条件
+     * @return array 返回类型
+     */
+    public function updateSystemconfig($where, $data)
+    {
+        $result = $this->where($where)->update($data);
+        return $result;
+
+    }//end updateReply()
+
+
+}

+ 2 - 2
application/admin/view/menu.html

@@ -90,10 +90,10 @@
             <a class="J_menuItem" href="{:url('system/basics')}">基础设置</a>
         </li>
         <li>
-            <a class="J_menuItem" href="{:url('system/reply')}">自动回复设置</a>
+            <a class="J_menuItem" href="{:url('system/conversation')}">会话设置</a>
         </li>
         <li>
-            <a class="J_menuItem" href="{:url('system/customerService')}">客服设置</a>
+            <a class="J_menuItem" href="{:url('system/reply')}">自动回复设置</a>
         </li>
     </ul>
 </li>

+ 1 - 1
application/admin/view/system/basics.html

@@ -66,7 +66,7 @@
                                 {/if}
                             </div>
                         </div>
-                        <div class="form-group">
+                        <div class="form-group" style="margin-top: 40px;">
                             <label class="col-sm-3 control-label"></label>
                             <div class="input-group col-sm-4">
                                 <button class="btn btn-primary" type="submit">提交</button>

+ 157 - 0
application/admin/view/system/conversation.html

@@ -0,0 +1,157 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>编辑管理员</title>
+    <link rel="shortcut icon" href="favicon.ico">
+    <link href="__CSS__/bootstrap.min.css?v=3.3.6" rel="stylesheet">
+    <link href="__CSS__/font-awesome.min.css?v=4.4.0" rel="stylesheet">
+    <link href="__CSS__/animate.min.css" rel="stylesheet">
+    <link href="__JS__/layui/css/layui.css" rel="stylesheet">
+    <link href="__CSS__/style.min.css?v=4.1.0" rel="stylesheet">
+</head>
+<body class="gray-bg">
+<div class="wrapper wrapper-content animated fadeInRight">
+    <div class="row">
+        <div class="col-sm-8">
+            <div class="ibox float-e-margins">
+                <div class="ibox-title">
+                    <h5>会话设置</h5>
+                </div>
+                <div class="ibox-content">
+                    <form class="form-horizontal m-t layui-form" id="commentForm" method="post" action="{:url('system/conversation')}">
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">会话超时设置:</label>
+                            <div class="input-group col-sm-1">
+                                <input type="text" class="form-control" name="overtime" required="" aria-required="true" value="{$systemconfig[0]['systemconfig_data']}">
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">访客静默设置:</label>
+                            <div class="input-group col-sm-1">
+                                <input type="text" class="form-control" name="unoperated" required="" aria-required="true" value="{$systemconfig[1]['systemconfig_data']}">
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">会话时长设置:</label>
+                            <div class="input-group col-sm-1">
+                                <input type="text" class="form-control" name="verifyAllTime" required="" aria-required="true" value="{$systemconfig[2]['systemconfig_data']}">
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">会话响应时长设置:</label>
+                            <div class="input-group col-sm-1">
+                                <input type="text" class="form-control" name="verifyReturnTime" required="" aria-required="true" value="{$systemconfig[3]['systemconfig_data']}">
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-sm-3 control-label">满意度评价回合限制:</label>
+                            <div class="input-group col-sm-1" style="width: 45px">
+                                <input type="text" class="form-control" name="round" required="" aria-required="true" value="{$systemconfig[4]['systemconfig_data']}">
+                            </div>
+                        </div>
+                        <div class="form-group" style="margin-top: 40px;">
+                            <label class="col-sm-3 control-label"></label>
+                            <div class="input-group col-sm-4">
+                                <button class="btn btn-primary" type="submit">提交</button>
+                            </div>
+                        </div>
+                    </form>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>
+<script src="__JS__/jquery.min.js?v=2.1.4"></script>
+<script src="__JS__/bootstrap.min.js?v=3.3.6"></script>
+<script src="__JS__/content.min.js?v=1.0.0"></script>
+<script src="__JS__/plugins/validate/jquery.validate.min.js"></script>
+<script src="__JS__/plugins/validate/messages_zh.min.js"></script>
+<script src="__JS__/plugins/layer/layer.min.js"></script>
+<script src="__JS__/layui/layui.js"></script>
+<script src="__JS__/jquery.form.js"></script>
+<script type="text/javascript">
+
+    layui.use(['form', 'upload'], function(){
+        var form = layui.form;
+        var upload = layui.upload;
+        //执行实例
+        var uploadInst = upload.render({
+            elem: '#up-avatar' //绑定元素
+            ,url: "{:url('users/upAvatar')}" //上传接口
+            ,exts: 'png|jpg|jpeg|gif'
+            ,done: function(res){
+                //上传完毕回调
+                if(0 == res.code){
+                    $("#avatar").html('<img src="' + res.data.src + '" width="50px" height="50px">');
+                    $("#advertisement_img").val(res.data.src);
+                }else{
+                    layer.msg(res.msg);
+                }
+            }
+            ,error: function(){
+                //请求异常回调
+            }
+        });
+
+        form.on('select(group)', function(value){
+            $("#group_id").val(value.value);
+        });
+    });
+
+    var index = '';
+    function showStart(){
+        index = layer.load(0, {shade: false});
+        return true;
+    }
+
+    function showSuccess(res){
+
+        layer.ready(function(){
+            layer.close(index);
+            if(1 == res.code){
+                layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
+                    window.location.href = res.data;
+                });
+            }else if(111 == res.code){
+                window.location.reload();
+            }else{
+                layer.msg(res.msg, {anim: 6});
+            }
+        });
+    }
+
+    $(document).ready(function(){
+        // 添加管理员
+        var options = {
+            beforeSubmit:showStart,
+            success:showSuccess
+        };
+
+        $('#commentForm').submit(function(){
+            $(this).ajaxSubmit(options);
+            return false;
+        });
+    });
+
+    // 表单验证
+    $.validator.setDefaults({
+        highlight: function(e) {
+            $(e).closest(".form-group").removeClass("has-success").addClass("has-error")
+        },
+        success: function(e) {
+            e.closest(".form-group").removeClass("has-error").addClass("has-success")
+        },
+        errorElement: "span",
+        errorPlacement: function(e, r) {
+            e.appendTo(r.is(":radio") || r.is(":checkbox") ? r.parent().parent().parent() : r.parent())
+        },
+        errorClass: "help-block m-b-none",
+        validClass: "help-block m-b-none"
+    });
+
+</script>
+</body>
+</html>

+ 38 - 1
application/index/controller/Evaluate.php

@@ -21,6 +21,7 @@ class Evaluate extends Common
         $code        = -2;
         $msg         = '错误';
         if ($tokenStatus === false) {
+            $msg = 'token错误';
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }
 
@@ -28,7 +29,7 @@ class Evaluate extends Common
             // 获取数据.
             $robot = model('Evaluate')->getEvaluate();
 
-            return json(['code' => 200, 'data' => $robot, 'msg' => '成功']);
+            return json(['code' => 1, 'data' => $robot, 'msg' => '成功']);
         } catch (\Exception $e) {
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }//end try
@@ -36,4 +37,40 @@ class Evaluate extends Common
     }//end index()
 
 
+    /**
+     * 评价
+     *
+     * @access public
+     * @return array JsonString
+     */
+    public function putEvaluate()
+    {
+        // 验证token.
+        $tokenStatus = $this->verifyApiToken();
+        $code        = -2;
+        $msg         = '错误';
+        if ($tokenStatus === false) {
+            $msg = 'token错误';
+            return json(['code' => $code, 'data' => [], 'msg' => $msg]);
+        }
+
+        try {
+            // 获取数据.
+            $evaluateId                = input('get.evaluateId');
+            $conversationId            = input('get.conversationId');
+            $evaluateContent           = input('get.evaluateContent');
+            $where['servicelog_id']    = $conversationId;
+            $where['evaluate_content'] = $evaluateContent;
+            $data['evaluate_id']       = $evaluateId;
+            // 评价.
+            $result = model('serviceLog')->getEvaluate($where, $data);
+
+            return json(['code' => 1, 'data' => $result, 'msg' => '成功']);
+        } catch (\Exception $e) {
+            return json(['code' => $code, 'data' => [], 'msg' => $msg]);
+        }//end try
+
+    }//end putEvaluate()
+
+
 }

+ 2 - 1
application/index/controller/Groups.php

@@ -22,6 +22,7 @@ class Groups extends Common
         $code        = -2;
         $msg         = '错误';
         if ($tokenStatus === false) {
+            $msg = 'token错误';
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }
 
@@ -30,7 +31,7 @@ class Groups extends Common
             // 获取符合条件数据.
             $groups = model('Groups')->select($groupsWhere);
 
-            return json(['code' => 200, 'data' => $groups, 'msg' => '成功']);
+            return json(['code' => 1, 'data' => $groups, 'msg' => '成功']);
         } catch (\Exception $e) {
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }

+ 4 - 2
application/index/controller/Robot.php

@@ -21,6 +21,7 @@ class Robot extends Common
         $code        = -2;
         $msg         = '错误';
         if ($tokenStatus === false) {
+            $msg = 'token错误';
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }
 
@@ -41,7 +42,7 @@ class Robot extends Common
             // 获取符合条件数据.
             $robot = model('Robot')->select($robotWhere);
 
-            return json(['code' => 200, 'data' => $robot, 'msg' => '成功']);
+            return json(['code' => 1, 'data' => $robot, 'msg' => '成功']);
         } catch (\Exception $e) {
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }//end try
@@ -62,6 +63,7 @@ class Robot extends Common
         $code        = -2;
         $msg         = '错误';
         if ($tokenStatus === false) {
+            $msg = 'token错误';
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }
 
@@ -70,7 +72,7 @@ class Robot extends Common
             // 获取符合条件数据.
             $robotGroups = model('Robotgroups')->select($robotGroupsWhere);
 
-            return json(['code' => 200, 'data' => $robotGroups, 'msg' => '成功']);
+            return json(['code' => 1, 'data' => $robotGroups, 'msg' => '成功']);
         } catch (\Exception $e) {
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }

+ 2 - 2
application/index/controller/Upload.php

@@ -29,7 +29,7 @@ class Upload extends Controller
         $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads');
         if($info){
             $src =  '/uploads' . '/' . date('Ymd') . '/' . $info->getFilename();
-            return json(['code' => 200, 'data' => ['src' => $src ], 'msg' => '']);
+            return json(['code' => 1, 'data' => ['src' => $src ], 'msg' => '']);
         }else{
             // 上传失败获取错误信息
             return json(['code' => -1, 'data' => '', 'msg' => $file->getError()]);
@@ -60,7 +60,7 @@ class Upload extends Controller
         $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads');
         if($info){
             $src =  '/uploads' . '/' . date('Ymd') . '/' . $info->getFilename();
-            return json(['code' => 200, 'data' => ['src' => $src ], 'msg' => $fileInfo['name']]);
+            return json(['code' => 1, 'data' => ['src' => $src ], 'msg' => $fileInfo['name']]);
         }else{
             // 上传失败获取错误信息
             return json(['code' => -1, 'data' => '', 'msg' => $file->getError()]);

+ 29 - 0
application/index/model/ServiceLog.php

@@ -0,0 +1,29 @@
+<?php
+namespace app\index\model;
+
+use think\Model;
+
+/**
+ * 工单模型
+ */
+class ServiceLog extends Model
+{
+
+
+    /**
+     * 修改工单
+     *
+     * @access public
+     * @param mixed $where 条件
+     * @param mixed $data 条件
+     * @return array 返回类型
+     */
+    public function getEvaluate($where, $data)
+    {
+        $result = $this->where($where)->update($data);
+        return $result;
+
+    }//end getEvaluate()
+
+
+}

+ 1 - 0
application/service/controller/Common.php

@@ -23,6 +23,7 @@ class Common extends Base
         $controller   = $request->controller();
         $module       = $request->module();
         $apiToken     = md5(strtolower($action.'Customer-Service'.$controller.strtotime(date('Y-m-d')).$module));
+        //print_r([$apiToken,$getApiToken]);die;
         // 验证服务器token.
         if ($getApiToken === $apiToken && empty($getUserToken) === false) {
             $usersField          = [

+ 6 - 3
application/service/controller/History.php

@@ -21,6 +21,7 @@ class History extends Common
         $code        = -2;
         $msg         = '错误';
         if ($tokenStatus === false) {
+            $msg = 'token错误';
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }
 
@@ -94,7 +95,7 @@ class History extends Common
             $result['list']        = $serviceLog;
             $result['pageSize']    = $pageSize;
 
-            return json(['code' => 200, 'data' => $result, 'msg' => '成功']);
+            return json(['code' => 1, 'data' => $result, 'msg' => '成功']);
         } catch (\Exception $e) {
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }//end try
@@ -115,6 +116,7 @@ class History extends Common
         $code        = -2;
         $msg         = '错误';
         if ($tokenStatus === false) {
+            $msg = 'token错误';
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }
 
@@ -138,7 +140,7 @@ class History extends Common
             $result['list']        = $chatLog;
             $result['pageSize']    = $pageSize;
 
-            return json(['code' => 200, 'data' => $result, 'msg' => '成功']);
+            return json(['code' => 1, 'data' => $result, 'msg' => '成功']);
         } catch (\Exception $e) {
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }//end try
@@ -159,6 +161,7 @@ class History extends Common
         $code        = -2;
         $msg         = '错误';
         if ($tokenStatus === false) {
+            $msg = 'token错误';
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }
 
@@ -189,7 +192,7 @@ class History extends Common
             $result['list']        = $chatLog;
             $result['pageSize']    = $pageSize;
 
-            return json(['code' => 200, 'data' => $result, 'msg' => '成功']);
+            return json(['code' => 1, 'data' => $result, 'msg' => '成功']);
         } catch (\Exception $e) {
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }//end try

+ 6 - 3
application/service/controller/Index.php

@@ -21,6 +21,7 @@ class Index extends Common
         $code        = -2;
         $msg         = '错误';
         if ($tokenStatus === false) {
+            $msg = 'token错误';
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }
 
@@ -38,7 +39,7 @@ class Index extends Common
             // 获取用户信息.
             $usersInfo = model('users')->findInfo($usersField, $usersWhere, $join);
 
-            return json(['code' => 200, 'data' => $usersInfo, 'msg' => '成功']);
+            return json(['code' => 1, 'data' => $usersInfo, 'msg' => '成功']);
         } catch (\Exception $e) {
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }//end try
@@ -59,6 +60,7 @@ class Index extends Common
         $code        = -2;
         $msg         = '错误';
         if ($tokenStatus === false) {
+            $msg = 'token错误';
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }
 
@@ -84,7 +86,7 @@ class Index extends Common
                 'userWords' => $userWords,
             ];
 
-            return json(['code' => 200, 'data' => $result, 'msg' => '成功']);
+            return json(['code' => 1, 'data' => $result, 'msg' => '成功']);
         } catch (\Exception $e) {
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }//end try
@@ -105,6 +107,7 @@ class Index extends Common
         $code        = -2;
         $msg         = '错误';
         if ($tokenStatus === false) {
+            $msg = 'token错误';
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }
 
@@ -126,7 +129,7 @@ class Index extends Common
                 'serverSensitive' => $serverSensitive,
             ];
 
-            return json(['code' => 200, 'data' => $data, 'msg' => '成功']);
+            return json(['code' => 1, 'data' => $data, 'msg' => '成功']);
         } catch (\Exception $e) {
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }//end try

+ 36 - 23
application/service/controller/Upload.php

@@ -7,32 +7,45 @@ class Upload extends Base
     //上传图片
     public function uploadImg()
     {
-        $file = request()->file('file');
+        // 验证token.
+        $tokenStatus = $this->verifyToken();
+        $code        = -2;
+        $msg         = '错误';
+        if ($tokenStatus === false) {
+            $msg = 'token错误';
+            return json(['code' => $code, 'data' => [], 'msg' => $msg]);
+        }
 
-        $fileInfo = $file->getInfo();
-        /*if($fileInfo['size'] > 1024 * 1024 * 2){
-            // 上传失败获取错误信息
-            return json( ['code' => -2, 'data' => '', 'msg' => '文件超过2M'] );
-        }*/
+        try {
+            $file = request()->file('file');
 
-        //检测图片格式
-        $ext = explode('.', $fileInfo['name']);
-        $ext = array_pop($ext);
+            $fileInfo = $file->getInfo();
+            /*if($fileInfo['size'] > 1024 * 1024 * 2){
+                // 上传失败获取错误信息
+                return json( ['code' => -2, 'data' => '', 'msg' => '文件超过2M'] );
+            }*/
 
-        $extArr = explode('|', 'jpg|png|gif|jpeg');
-        if(!in_array($ext, $extArr)){
-            return json(['code' => -3, 'data' => '', 'msg' => '只能上传jpg|png|gif|jpeg的文件']);
-        }
+            //检测图片格式
+            $ext = explode('.', $fileInfo['name']);
+            $ext = array_pop($ext);
 
-        // 移动到框架应用根目录/public/uploads/ 目录下
-        $info = $file->move(ROOT_PATH . 'public' . DS . 'uploads');
-        if($info){
-            $src =  '/uploads' . '/' . date('Ymd') . '/' . $info->getFilename();
-            return json(['code' => 0, 'data' => ['src' => $src ], 'msg' => '']);
-        }else{
-            // 上传失败获取错误信息
-            return json(['code' => -1, 'data' => '', 'msg' => $file->getError()]);
-        }
+            $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){
+                $src =  '/uploads' . '/' . date('Ymd') . '/' . $info->getFilename();
+                return json(['code' => 0, 'data' => ['src' => $src ], 'msg' => '']);
+            }else{
+                // 上传失败获取错误信息
+                return json(['code' => -1, 'data' => '', 'msg' => $file->getError()]);
+            }
+        } catch (\Exception $e) {
+            return json(['code' => $code, 'data' => [], 'msg' => $msg]);
+        }//end try
     }
 
     //上传文件
@@ -65,4 +78,4 @@ class Upload extends Base
             return json(['code' => -1, 'data' => '', 'msg' => $file->getError()]);
         }
     }
-}
+}

+ 21 - 21
application/service/controller/Words.php

@@ -21,6 +21,7 @@ class Words extends Common
         $code        = -2;
         $msg         = '错误';
         if ($tokenStatus === false) {
+            $msg = 'token错误';
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }
 
@@ -38,7 +39,7 @@ class Words extends Common
             // 查询用户私有快捷语.
             $userWords = model('words')->selectWords($wordsField, $userWordsWhere);
 
-            return json(['code' => 200, 'data' => $userWords, 'msg' => '成功']);
+            return json(['code' => 1, 'data' => $userWords, 'msg' => '成功']);
         } catch (\Exception $e) {
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }//end try
@@ -59,6 +60,7 @@ class Words extends Common
         $code        = -2;
         $msg         = '错误';
         if ($tokenStatus === false) {
+            $msg = 'token错误';
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }
 
@@ -95,7 +97,7 @@ class Words extends Common
 
             // 参数返回.
             if (isset($result) === true) {
-                return json(['code' => 200, 'data' => [], 'msg' => '成功']);
+                return json(['code' => 1, 'data' => [], 'msg' => '成功']);
             } else {
                 return json(['code' => 1, 'data' => [], 'msg' => 1]);
             }
@@ -119,24 +121,21 @@ class Words extends Common
         $code        = -2;
         $msg         = '错误';
         if ($tokenStatus === false) {
+            $msg = 'token错误';
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }
 
         try {
             // 获取用户信息.
-            $getUserInfo    = $this->getUserInfo();
-            $userWordsWhere = [
-                'user_id' => $getUserInfo->id,
-                'id'      => input('post.id'),
-            ];
-            $deleteResult   = model('Words')->deleteWords($userWordsWhere);
+            $getUserInfo               = $this->getUserInfo();
+            $userWordsWhere['user_id'] = $getUserInfo->id;
+            foreach (input('post.') as $v) {
+                $userWordsWhere['id'] = $v;
+                model('Words')->deleteWords($userWordsWhere);
+            }
 
             // 参数返回.
-            if (empty($deleteResult) === false) {
-                return json(['code' => 200, 'data' => [], 'msg' => '成功']);
-            } else {
-                return json(['code' => 1, 'data' => [], 'msg' => 1]);
-            }
+            return json(['code' => 1, 'data' => [], 'msg' => '成功']);
         } catch (\Exception $e) {
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }//end try
@@ -157,24 +156,25 @@ class Words extends Common
         $code        = -2;
         $msg         = '错误';
         if ($tokenStatus === false) {
+            $msg = 'token错误';
             return json(['code' => $code, 'data' => [], 'msg' => $msg]);
         }
 
         try {
             // 获取用户信息.
-            $getUserInfo    = $this->getUserInfo();
+            $getUserInfo   = $this->getUserInfo();
             $userWordsData = [
-                'user_id' => $getUserInfo->id,
-                'title'      => input('post.title'),
-                'content'      => input('post.content'),
-                'status'      => input('post.status'),
-                'add_time'      => date('Y-m-d H:i:s'),
+                'user_id'  => $getUserInfo->id,
+                'title'    => input('post.title'),
+                'content'  => input('post.content'),
+                'status'   => input('post.status'),
+                'add_time' => date('Y-m-d H:i:s'),
             ];
-            $deleteResult   = model('Words')->addWords($userWordsData);
+            $deleteResult  = model('Words')->addWords($userWordsData);
 
             // 参数返回.
             if (empty($deleteResult) === false) {
-                return json(['code' => 200, 'data' => [], 'msg' => '成功']);
+                return json(['code' => 1, 'data' => [], 'msg' => '成功']);
             } else {
                 return json(['code' => 1, 'data' => [], 'msg' => 1]);
             }

+ 1 - 1
public/static/service/js/whisper.js

@@ -17,7 +17,7 @@ socket.onopen = function (res) {
         });
     });
     // 登录
-    var login_data = '{"type":"init", "uid":"' + uinfo.id + '", "name" : "' + uinfo.username + '", "avatar" : "'
+    var login_data = '{"type":"init", "uid":"' + uinfo.id + '", "token":"NzQ1MTM5IyRAJSFeKi8xNTYyMjkxMTczLzg=", "name" : "' + uinfo.username + '", "avatar" : "'
         + uinfo.avatar + '", "group": ' + uinfo.group + '}';
     socket.send(login_data);
 };

+ 225 - 200
vendor/GatewayWorker_windows/Applications/whisper/Events.php

@@ -93,83 +93,16 @@ class Events
             Timer::add(60 * 1, function () {
                 self::lineup();
             });
+            Timer::add(60 * 1, function () {
+                self::lineup();
+            });
+            // 检查对话时效给出.
+            Timer::add(60, function () {
+                self::overTime();
+            });
 
 
         }
-
-
-        // 检查对话时效给出.
-        Timer::add(60, function () {
-            // 查询对话时效设置.
-            $systemConfigData = self::$db->query("SELECT `systemconfig_data`,`systemconfig_enName`,`systemconfig_content` FROM `ws_systemconfig`");
-            foreach ($systemConfigData as $k => $v) {
-                if ($v['systemconfig_enName'] == 'overtime') {
-                    self::$global->overtime = $v;
-                } elseif ($v['systemconfig_enName'] == 'unoperated') {
-                    self::$global->unoperated = $v;
-                } elseif ($v['systemconfig_enName'] == 'noResponse') {
-                    self::$global->noResponse = $v;
-                }
-            }
-            // 查询未断开的工单.
-            $serviceLog = self::$db->query("SELECT `servicelog_id`,`client_id`,`start_time` FROM `ws_service_log` WHERE `status`='1' OR `status`='3'");
-            $whereOr = '1=0';
-            foreach ($serviceLog as $k => $v) {
-                if ($k == 0) {
-                    $whereOr = "`servicelog_id`=" . $v['servicelog_id'];
-                } else {
-                    $whereOr .= " OR `servicelog_id`=" . $v['servicelog_id'];
-                }
-            }
-            // 查询最后一次会话.
-            //$chatLog = self::$db->query("SELECT `servicelog_id`,MAX(`time_line`) FROM `ws_chat_log` WHERE ".$whereOr." group by `servicelog_id`");
-            $chatLog = self::$db->query("
-                select * from ws_chat_log as a where  time_line=(
-                  select max(b.time_line) from ws_chat_log as b where a.servicelog_id = b.servicelog_id and (" . $whereOr . ") group by servicelog_id
-                )
-            ");
-            $setOvertime = strtotime('-' . (self::$global->overtime['systemconfig_data'] - 60) . ' second');
-            $overtime = strtotime('-' . (self::$global->overtime['systemconfig_data']) . ' second');
-            $setUnoperated = strtotime('-' . (self::$global->unoperated['systemconfig_data'] - 60) . ' second');
-            $unoperated = strtotime('-' . (self::$global->unoperated['systemconfig_data']) . ' second');
-            $noResponse = strtotime('-' . (self::$global->noResponse['systemconfig_data']) . ' second');
-            foreach ($serviceLog as $k => $v) {//注意该循环时间
-                if (!strlen(array_search($v['servicelog_id'], array_column($chatLog, 'servicelog_id')))) {
-                    // 如果小于设定时间则关闭会话.
-                    if ($v['start_time'] <= $unoperated) {
-                        self::serverClose($v['client_id'], $v['servicelog_id']);
-                        // 如果小于设定时间前一分钟则给出提示.
-                    } elseif ($v['start_time'] <= $setUnoperated) {
-                        $chat_message = [
-                            'message_type' => 'overtime',
-                            'data' => [
-                                'content' => htmlspecialchars(self::$global->unoperated['systemconfig_content']),
-                            ]
-                        ];
-                        Gateway::sendToClient($v['client_id'], json_encode($chat_message));
-                    }
-                }
-            }
-            // 循环检测会话时效.
-            foreach ($chatLog as $k => $v) {
-                $toWho = substr($v['to_id'], 0, 2);
-                // 如果对话为客服的最后一次对话且时间小于设定时间则结束工单.
-                if ($v['time_line'] <= $overtime) {
-                    $found_key = array_search($v['servicelog_id'], array_column($serviceLog, 'servicelog_id'));
-                    self::serverClose($serviceLog[$found_key]['client_id'], $v['servicelog_id']);
-                    // 如果对话为客服的最后一次对话且时间小于设定时间前一分钟则给出提示.
-                } elseif ($v['time_line'] <= $setOvertime) {
-                    $chat_message = [
-                        'message_type' => 'overtime',
-                        'data' => [
-                            'content' => htmlspecialchars(self::$global->overtime['systemconfig_content']),
-                        ]
-                    ];
-                    $found_key = array_search($v['servicelog_id'], array_column($serviceLog, 'servicelog_id'));
-                    Gateway::sendToClient($serviceLog[$found_key]['client_id'], json_encode($chat_message, 256));
-                }
-            }
-        });
     }
 
     /**
@@ -259,8 +192,8 @@ class Events
             echo "onMessage: " . $message . "\r\n";
             print_r([self::$global->kfList, self::$global->userList, self::$global->uidSimpleList, self::$global->userToKf]);
         }
-
         $message = json_decode($message, true);
+        if (isset($message['type'])) {
         switch ($message['type']) {
             // 客服初始化
             case 'init':
@@ -302,145 +235,157 @@ class Events
                         'time_line' => time()
                     ];
 
-                    self::$db->insert('ws_chat_log')->cols($serviceLog)->query();
-                    unset($serviceLog);
-                }
-                break;
-            // 转接
-            case 'changeGroup':
-                // 通知客户端转接中
-                $simpleList = self::$global->uidSimpleList;
+                        self::$db->insert('ws_chat_log')->cols($serviceLog)->query();
+                        unset($serviceLog);
+                    }
+                    break;
+                // 转接
+                case 'changeGroup':
+                    // 通知客户端转接中
+                    $simpleList = self::$global->uidSimpleList;
 
-                if (!isset($simpleList[$message['uid']])) { // 客户已经退出
-                    return;
-                }
+                    if (!isset($simpleList[$message['uid']])) { // 客户已经退出
+                        return;
+                    }
 
-                $userClient = $simpleList[$message['uid']]['0'];
-                $userGroup = $simpleList[$message['uid']]['1'];  // 会员原来的分组也是客服的分组
+                    $userClient = $simpleList[$message['uid']]['0'];
+                    $userGroup = $simpleList[$message['uid']]['1'];  // 会员原来的分组也是客服的分组
 
-                $reLink = [
-                    'message_type' => 'relinkMessage'
-                ];
-                Gateway::sendToClient($userClient, json_encode($reLink));
-                unset($reLink);
+                    $reLink = [
+                        'message_type' => 'relinkMessage'
+                    ];
+                    Gateway::sendToClient($userClient, json_encode($reLink, 256));
+                    unset($reLink);
+
+                    // 记录该客服与该会员的服务结束
+                    self::$db->query("update `ws_service_log` set `end_time` = " . time() . " , `status` = '2' where `client_id`= '" . $userClient . "'");
+
+                    // 从当前客服的服务表中删除这个会员
+                    $old = $kfList = self::$global->kfList;
+                    if (!isset($kfList[$userGroup])) {
+                        $waitMsg = '暂时没有相关客服上班,请稍后再咨询。';
+                        // 逐一通知
+                        foreach (self::$global->userList as $vo) {
+
+                            $waitMessage = [
+                                'message_type' => 'wait',
+                                'data' => [
+                                    'content' => $waitMsg,
+                                ]
+                            ];
+                            Gateway::sendToClient($userClient, json_encode($waitMessage, 256));
+                            unset($waitMessage);
+                        }
+                        return;
+                    }
+                    $myList = $kfList[$userGroup]; // 该客服分组数组
+                    foreach ($myList as $key => $vo) {
+                        if (in_array($userClient, $vo['user_info'])) {
+
+                            // 维护现在的该客服的服务信息
+                            $kfList[$userGroup][$key]['task'] -= 1; // 当前服务的人数 -1
+                            foreach ($vo['user_info'] as $k => $v) {
+                                if ($userClient == $v) {
+                                    unset($kfList[$userGroup][$key]['user_info'][$k]);
+                                    break;
+                                }
+                            }
+
+                            break;
+                        }
+                    }
+                    while (!self::$global->cas('kfList', $old, $kfList)) {
+                    }; // 刷新内存中客服的服务列表
+                    unset($old, $kfList, $myList);
+
+                    // 将会员加入队列中
+                    $userList = self::$global->userList;
+                    do {
+                        $NewUserList = $userList;
+                        $NewUserList[$message['uid']] = [
+                            'id' => $message['uid'],
+                            'name' => $message['name'],
+                            'avatar' => $message['avatar'],
+                            'ip' => $message['ip'],
+                            'group' => $message['group'], // 指定要链接的分组
+                            'client_id' => $userClient
+                        ];
 
-                // 记录该客服与该会员的服务结束
-                self::$db->query("update `ws_service_log` set `end_time` = " . time() . " , `status` = '2' where `client_id`= '" . $userClient . "'");
+                    } while (!self::$global->cas('userList', $userList, $NewUserList));
+                    unset($NewUserList, $userList);
 
-                // 从当前客服的服务表中删除这个会员
-                $old = $kfList = self::$global->kfList;
-                if (!isset($kfList[$userGroup])) {
-                    $waitMsg = '暂时没有相关客服上班,请稍后再咨询。';
-                    // 逐一通知
-                    foreach (self::$global->userList as $vo) {
+                    // 执行会员分配通知双方
+                    self::userOnlineTask($userClient, $message['group']);
+                    unset($userClient, $userGroup);
+
+                    break;
+                case 'closeUser':
 
+                    $userInfo = self::$global->uidSimpleList;
+                    if (isset($userInfo[$message['uid']])) {
                         $waitMessage = [
                             'message_type' => 'wait',
                             'data' => [
-                                'content' => $waitMsg,
+                                'content' => '暂时没有客服上班,请稍后再咨询。',
                             ]
                         ];
-                        Gateway::sendToClient($userClient, json_encode($waitMessage, 256));
+                        Gateway::sendToClient($userInfo[$message['uid']]['0'], json_encode($waitMessage, 256));
                         unset($waitMessage);
                     }
-                    return;
-                }
-                $myList = $kfList[$userGroup]; // 该客服分组数组
-                foreach ($myList as $key => $vo) {
-                    if (in_array($userClient, $vo['user_info'])) {
-
-                        // 维护现在的该客服的服务信息
-                        $kfList[$userGroup][$key]['task'] -= 1; // 当前服务的人数 -1
-                        foreach ($vo['user_info'] as $k => $v) {
-                            if ($userClient == $v) {
-                                unset($kfList[$userGroup][$key]['user_info'][$k]);
-                                break;
+                    unset($userInfo);
+                    break;
+                // 机器人问答.
+                case 'toRobot':
+                    self::toRobot($client_id, $message);
+                    break;
+                // 评价.
+                case 'evaluate':
+                    self::evaluate($client_id, $message);
+                    break;
+                // 客服关闭会话.
+                case 'kfCloseUser':
+                    $client = Gateway::getClientIdByUid($userId);
+                    if (!empty($client)) {
+                        $userId = $message['data']['to_id'];
+                        $kfId = $message['data']['kf_id'];
+                        $groupId = $message['data']['group_id'];
+                        $clientId = $client['0'];
+                        $sql = "select 'servicelog_id' from `ws_service_log` where `user_id`= '$userId' and `client_id`= '$clientId' and `status`!= '2' and `group_id`!= '$groupId' and `kf_id`!= '$kfId'";
+                        $serviceLog = self::$db->query($sql);
+                        self::serverClose($clientId, $serviceLog[0]['servicelog_id']);
+                    }
+                    break;
+                // 客服更改状态.
+                case 'kfOnline':
+                    $kfList = self::$global->kfList;
+                    $userId = $message['data']['uid'];
+                    $status = $message['data']['status'];
+                    foreach ($kfList as $k => $v) {
+                        foreach ($v as $ke => $va) {
+                            if ($ke == $userId) {
+                                $kfList[$k][$ke]['status'] = $status;
                             }
                         }
-
-                        break;
                     }
-                }
-                while (!self::$global->cas('kfList', $old, $kfList)) {
-                }; // 刷新内存中客服的服务列表
-                unset($old, $kfList, $myList);
-
-                // 将会员加入队列中
-                $userList = self::$global->userList;
-                do {
-                    $NewUserList = $userList;
-                    $NewUserList[$message['uid']] = [
-                        'id' => $message['uid'],
-                        'name' => $message['name'],
-                        'avatar' => $message['avatar'],
-                        'ip' => $message['ip'],
-                        'group' => $message['group'], // 指定要链接的分组
-                        'client_id' => $userClient
-                    ];
-
-                } while (!self::$global->cas('userList', $userList, $NewUserList));
-                unset($NewUserList, $userList);
-
-                // 执行会员分配通知双方
-                self::userOnlineTask($userClient, $message['group']);
-                unset($userClient, $userGroup);
-
-                break;
-            case 'closeUser':
-
-                $userInfo = self::$global->uidSimpleList;
-                if (isset($userInfo[$message['uid']])) {
-                    $waitMessage = [
-                        'message_type' => 'wait',
-                        'data' => [
-                            'content' => '暂时没有客服上班,请稍后再咨询。',
-                        ]
-                    ];
-                    Gateway::sendToClient($userInfo[$message['uid']]['0'], json_encode($waitMessage, 256));
-                    unset($waitMessage);
-                }
-                unset($userInfo);
-                break;
-            // 机器人问答.
-            case 'toRobot':
-                self::toRobot($client_id, $message);
-                break;
-            // 评价.
-            case 'evaluate':
-                self::evaluate($client_id, $message);
-                break;
-            // 客服关闭会话.
-            case 'kfCloseUser':
-                $client = Gateway::getClientIdByUid($userId);
-                if (!empty($client)) {
-                    $userId = $message['data']['to_id'];
-                    $kfId = $message['data']['kf_id'];
-                    $groupId = $message['data']['group_id'];
-                    $clientId = $client['0'];
-                    $sql = "select 'servicelog_id' from `ws_service_log` where `user_id`= '$userId' and `client_id`= '$clientId' and `status`!= '2' and `group_id`!= '$groupId' and `kf_id`!= '$kfId'";
-                    $serviceLog = self::$db->query($sql);
-                    self::serverClose($clientId, $serviceLog[0]['servicelog_id']);
-                }
-                break;
-            // 客服更改状态.
-            case 'kfOnline':
-                $kfList = self::$global->kfList;
-                $userId = $message['data']['uid'];
-                $status = $message['data']['status'];
-                foreach ($kfList as $k => $v) {
-                    foreach ($v as $ke => $va) {
-                        if ($ke == $userId) {
-                            $kfList[$k][$ke]['status'] = $status;
-                        }
+                    self::$global->kfList = $kfList;
+                    break;
+                case 'changeOtherhKeFu';
+                    self::changeOtherhKeFu($client_id, $message);
+                    break;
+                // 弹出评价.
+                case 'getEvaluate';
+                    $client = Gateway::getClientIdByUid($message['data']['to_id']);
+                    if (!empty($client)) {
+                        $chat_message = [
+                            'message_type' => 'getEvaluate',
+                            'data' => [
+                                'content' => '欢迎你的咨询,请对我们的服务做出评价',
+                            ]
+                        ];
+                        Gateway::sendToClient($client['0'], json_encode($chat_message, 256));
+                        unset($chat_message);
                     }
-                }
-                self::$global->kfList = $kfList;
-                break;
-            case 'changeOtherhKeFu';
-                self::changeOtherhKeFu($client_id, $message);
-                break;
-            // default:
-            //    Gateway::closeClient($client_id);
+            }
         }
 
     }
@@ -713,7 +658,7 @@ class Events
     {
         $isKefuoff = isset($_SESSION['iskefu']) ? $_SESSION['iskefu'] : 0;
         $uid = isset($_SESSION['uid']) ? $_SESSION['uid'] : false;
-        echo "下线:$uid  - $client_id - $isKefuoff \n";
+        //echo "下线:$uid  - $client_id - $isKefuoff \n";
 
         if (empty($uid)) {
             return;
@@ -1420,13 +1365,15 @@ class Events
         // 查询问题.
         $getRobot = self::$db->query("select `robot_content` from `ws_robot` where `robot_status`= 1 and `groups_id`= '" . $groups_id . "' and `robot_name`= '" . $robot_name . "' and `robotgroups_id`= '" . $robotgroups_id . "'");
         $chat_message = [
-            'message_type' => 'chatMessage',
+            'message_type' => 'robotMessage',
+            //'message_type' => 'chatMessage',
             'data' => [
                 'name' => '智能助手',
                 'time' => date('H:i'),
                 'content' => $getRobot ? htmlspecialchars($getRobot[0]['robot_content']) : 'error',
             ]
         ];
+        sleep(1);
         Gateway::sendToClient($client_id, json_encode($chat_message, 256));
     }
 
@@ -1457,7 +1404,85 @@ class Events
                 ]
             ];
         }
-        Gateway::sendToClient($client_id, json_encode($chat_message));
+        Gateway::sendToClient($client_id, json_encode($chat_message, 256));
+    }
+
+    /**
+     * 超时
+     * @param $client_id 服务ID
+     * @param $message 数据
+     */
+    private static function overTime()
+    {
+        // 查询对话时效设置.
+        $systemConfigData = self::$db->query("SELECT `systemconfig_data`,`systemconfig_enName`,`systemconfig_content` FROM `ws_systemconfig`");
+        foreach ($systemConfigData as $k => $v) {
+            if ($v['systemconfig_enName'] == 'overtime') {
+                self::$global->overtime = $v;
+            } elseif ($v['systemconfig_enName'] == 'unoperated') {
+                self::$global->unoperated = $v;
+            } elseif ($v['systemconfig_enName'] == 'noResponse') {
+                self::$global->noResponse = $v;
+            }
+        }
+        // 查询未断开的工单.
+        $serviceLog = self::$db->query("SELECT `servicelog_id`,`client_id`,`start_time` FROM `ws_service_log` WHERE `status`='1' OR `status`='3'");
+        $whereOr = '1=0';
+        foreach ($serviceLog as $k => $v) {
+            if ($k == 0) {
+                $whereOr = "`servicelog_id`=" . $v['servicelog_id'];
+            } else {
+                $whereOr .= " OR `servicelog_id`=" . $v['servicelog_id'];
+            }
+        }
+        // 查询最后一次会话.
+        //$chatLog = self::$db->query("SELECT `servicelog_id`,MAX(`time_line`) FROM `ws_chat_log` WHERE ".$whereOr." group by `servicelog_id`");
+        $chatLog = self::$db->query("
+                select * from ws_chat_log as a where  time_line=(
+                  select max(b.time_line) from ws_chat_log as b where a.servicelog_id = b.servicelog_id and (" . $whereOr . ") group by servicelog_id
+                )
+            ");
+        $setOvertime = strtotime('-' . (self::$global->overtime['systemconfig_data'] - 60) . ' second');
+        $overtime = strtotime('-' . (self::$global->overtime['systemconfig_data']) . ' second');
+        $setUnoperated = strtotime('-' . (self::$global->unoperated['systemconfig_data'] - 60) . ' second');
+        $unoperated = strtotime('-' . (self::$global->unoperated['systemconfig_data']) . ' second');
+        $noResponse = strtotime('-' . (self::$global->noResponse['systemconfig_data']) . ' second');
+        foreach ($serviceLog as $k => $v) {//注意该循环时间
+            if (!strlen(array_search($v['servicelog_id'], array_column($chatLog, 'servicelog_id')))) {
+                // 如果小于设定时间则关闭会话.
+                if ($v['start_time'] <= $unoperated) {
+                    self::serverClose($v['client_id'], $v['servicelog_id']);
+                    // 如果小于设定时间前一分钟则给出提示.
+                } elseif ($v['start_time'] <= $setUnoperated) {
+                    $chat_message = [
+                        'message_type' => 'overtime',
+                        'data' => [
+                            'content' => htmlspecialchars(self::$global->unoperated['systemconfig_content']),
+                        ]
+                    ];
+                    Gateway::sendToClient($v['client_id'], json_encode($chat_message, 256));
+                }
+            }
+        }
+        // 循环检测会话时效.
+        foreach ($chatLog as $k => $v) {
+            $toWho = substr($v['to_id'], 0, 2);
+            // 如果对话为客服的最后一次对话且时间小于设定时间则结束工单.
+            if ($v['time_line'] <= $overtime) {
+                $found_key = array_search($v['servicelog_id'], array_column($serviceLog, 'servicelog_id'));
+                self::serverClose($serviceLog[$found_key]['client_id'], $v['servicelog_id']);
+                // 如果对话为客服的最后一次对话且时间小于设定时间前一分钟则给出提示.
+            } elseif ($v['time_line'] <= $setOvertime) {
+                $chat_message = [
+                    'message_type' => 'overtime',
+                    'data' => [
+                        'content' => htmlspecialchars(self::$global->overtime['systemconfig_content']),
+                    ]
+                ];
+                $found_key = array_search($v['servicelog_id'], array_column($serviceLog, 'servicelog_id'));
+                Gateway::sendToClient($serviceLog[$found_key]['client_id'], json_encode($chat_message, 256));
+            }
+        }
     }