瀏覽代碼

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

Jonlin 6 年之前
父節點
當前提交
910de1e548

+ 10 - 0
application/admin/controller/Login.php

@@ -10,6 +10,16 @@ use think\Controller;
 
 class Login extends Controller
 {
+    // 稳定性测试
+    /*public function aaaa()
+    {
+        $accounts = db('accounts')->select();
+        $this->assign([
+            'accounts' => json_encode($accounts),
+            'socket' => config('socket'),
+        ]);
+        return $this->fetch();
+    }*/
     // 登录首页
     public function index()
     {

+ 7 - 5
application/admin/controller/System.php

@@ -113,9 +113,13 @@ class System extends Base
                 $upRoundWhere['systemconfig_id']  = 5;
                 model('Systemconfig')->updateSystemconfig($upRoundWhere, $upRoundData);
                 // 客服接待人数设置.
-                $upKfConfigData['max_service']      = $param['max_service'];
-                $upKfConfigData['kfConfig_maxWait'] = $param['kfConfig_maxWait'];
-                db('kf_config')->where('id', 1)->update($upKfConfigData);
+                $upMSWhere['systemconfig_enName'] = 'KFMaxServices';
+                $upMSData['systemconfig_data']    = $param['max_service'];
+                model('Systemconfig')->updateSystemconfig($upMSWhere, $upMSData);
+                // 最大排队人数设置.
+                $upMWWhere['systemconfig_enName'] = 'maxWait';
+                $upMWData['systemconfig_data']    = $param['kfConfig_maxWait'];
+                model('Systemconfig')->updateSystemconfig($upMWWhere, $upMWData);
 
                 return json(['code' => 1, 'data' => '', 'msg' => '设置成功']);
             } catch (\Exception $e) {
@@ -125,11 +129,9 @@ class System extends Base
 
         // 获取设置.
         $systemconfig = model('Systemconfig')->selectSystemconfig();
-        $kfConfig     = db('kf_config')->where('id', 1)->find();
         $this->assign(
             [
                 'systemconfig' => $systemconfig,
-                'kfConfig'     => $kfConfig,
                 'status'       => config('kf_status'),
             ]
         );

+ 8 - 0
application/admin/view/index/index.html

@@ -371,6 +371,14 @@
                 break;
         }
     };
+
+    socket.onclose = function(res) {
+      layer.alert('实时监控断开', {
+        title: '友情提示', icon: 1, closeBtn: 0
+      }, function(){});
+    };
+
+
     /**
      * 时间戳转化为年 月 日 时 分 秒
      * time: 传入时间戳

+ 2 - 2
application/admin/view/system/conversation.html

@@ -100,14 +100,14 @@
                             <p style="width: 100%; margin-left: 20px; color: #9c9c9c; margin-bottom: 15px; font-size: 15px;">当客服服务达到上限时,顾客会进入排队等待状态。当排队人数达上限,后续不再接入顾客。</p>
                             <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="max_service" required="" aria-required="true" value="{$kfConfig['max_service']}">
+                                <input type="text" class="form-control" name="max_service" required="" aria-required="true" value="{$systemconfig[6]['systemconfig_data']}">
                             </div>
                             <label class="control-label" style="margin-left: 20px;">人</label>
                         </div>
                         <div class="form-group" style="flex-wrap: wrap; display: flex">
                             <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="kfConfig_maxWait" required="" aria-required="true" value="{$kfConfig['kfConfig_maxWait']}">
+                                <input type="text" class="form-control" name="kfConfig_maxWait" required="" aria-required="true" value="{$systemconfig[7]['systemconfig_data']}">
                             </div>
                             <label class="control-label" style="margin-left: 20px;">人</label>
                         </div>

+ 115 - 43
vendor/GatewayWorker_windows/Applications/whisper/Events.php

@@ -988,7 +988,17 @@ class Events
 
         $userInfo['intime'] = date("H:i", $userInfo['intime']);  ///后改为只显示小时分
         $ut_tmp = self::getUserInfoCache($uid);
-        $userInfo = array_merge($userInfo, ['account_name' => $ut_tmp['account_name'], 'nick_name' => $ut_tmp['nick_name'], 'account_email' => $ut_tmp['account_email'], 'account_phone' => $ut_tmp['account_phone'], 'address' => $ut_tmp['address'], 'remark' => $ut_tmp['remark'], 'label' => self::$global->accountslabel[$ut_tmp['label_id']]['name']]);
+        $userInfo = array_merge($userInfo,
+            [
+                'account_name' => $ut_tmp['account_name'],
+                'nick_name' => $ut_tmp['nick_name'],
+                'account_email' => $ut_tmp['account_email'],
+                'account_phone' => $ut_tmp['account_phone'],
+                'address' => $ut_tmp['address'],
+                'remark' => $ut_tmp['remark'],
+                'label' => self::$global->accountslabel[$ut_tmp['label_id']]['name']
+            ]
+        );
         $noticeKf = [
             'message_type' => 'connect',
             'data' => [
@@ -1651,59 +1661,121 @@ class Events
             unset($oldKey, $key);
         }
 
-        // 定时统计数据
-        if (0 == $worker->id) {
+        if (strtolower(substr(PHP_OS, 0, 3)) == 'win') {
+            // 定时统计数据
+            if (0 == $worker->id) {
 
-            self::writeLogKfStatus(0, 0, 0);
+                self::writeLogKfStatus(0, 0, 0);
 
-            //每5秒更新进行一次人员分配
-            Timer::add(5, function () {
-                self::userOnlineTask();
-            });
+                //每5秒更新进行一次人员分配
+                Timer::add(5, function () {
+                    self::userOnlineTask();
+                });
 
-            //每1分钟报告一次本组排列人员(如果有人排队)
-            Timer::add(60, function () {
-                self::lineup();
-            });
+                //每1分钟报告一次本组排列人员(如果有人排队)
+                Timer::add(60, function () {
+                    self::lineup();
+                });
 
 
-            // 1分钟统计一次实时数据
-            Timer::add(60 * 1, function () {
-                self::writeLog(1);
-            });
-            // 40分钟写一次当前日期点数的log数据
-            Timer::add(60 * 40, function () {
-                self::writeLog(2);
-            });
+                // 1分钟统计一次实时数据
+                Timer::add(60 * 1, function () {
+                    self::writeLog(1);
+                });
+                // 40分钟写一次当前日期点数的log数据
+                Timer::add(60 * 40, function () {
+                    self::writeLog(2);
+                });
 
-            //初始化.....
-            self::upsystemconfig();
-            //每3分钟更新一次系统配置文件
-            Timer::add(60 * 3, function () {
+                //初始化.....
                 self::upsystemconfig();
-            });
+                //每3分钟更新一次系统配置文件
+                Timer::add(60 * 3, function () {
+                    self::upsystemconfig();
+                });
+
+                // 删除前一天的统计值
+                Timer::add(60 * 60 * 12, function () {
+                    $oldKey = date('Ymd', strtotime('-1 day'));
+                    unset(self::$global->$oldKey);
+                });
+
+                // 管理员实时监控.
+                Timer::add(20, function () {
+                    // 获取在线管理员
+                    $adminList = self::$redis->smembers('adminList');
+                    if ($adminList) {
+                        self::systemMonitoring($adminList);
+                    }
+                });
 
-            // 删除前一天的统计值
-            Timer::add(60 * 60 * 12, function () {
-                $oldKey = date('Ymd', strtotime('-1 day'));
-                unset(self::$global->$oldKey);
-            });
+                // 检查对话时效给出.
+                Timer::add(40, function () {
+                    self::overTime();
+                });
 
-            // 管理员实时监控.
-            Timer::add(20, function () {
-                // 获取在线管理员
-                $adminList = self::$redis->smembers('adminList');
-                if ($adminList) {
-                    self::systemMonitoring($adminList);
-                }
-            });
+                self::resetServiceLog();
+            }
+        } else {
+            ///linux 下支持多进程....
 
-            // 检查对话时效给出.
-            Timer::add(40, function () {
-                self::overTime();
-            });
+            if (0 == $worker->id) {
 
-            self::resetServiceLog();
+                self::writeLogKfStatus(0, 0, 0);
+
+                //每5秒更新进行一次人员分配
+                Timer::add(5, function () {
+                    self::userOnlineTask();
+                });
+
+                //每1分钟报告一次本组排列人员(如果有人排队)
+                Timer::add(60, function () {
+                    self::lineup();
+                });
+
+                self::resetServiceLog();
+
+            } elseif (1 == $worker->id) {
+
+                // 1分钟统计一次实时数据
+                Timer::add(60 * 1, function () {
+                    self::writeLog(1);
+                });
+                // 40分钟写一次当前日期点数的log数据
+                Timer::add(60 * 40, function () {
+                    self::writeLog(2);
+                });
+
+            } elseif (2 == $worker->id) {
+
+                //初始化.....
+                self::upsystemconfig();
+                //每3分钟更新一次系统配置文件
+                Timer::add(60 * 3, function () {
+                    self::upsystemconfig();
+                });
+
+                // 删除前一天的统计值
+                Timer::add(60 * 60 * 12, function () {
+                    $oldKey = date('Ymd', strtotime('-1 day'));
+                    unset(self::$global->$oldKey);
+                });
+
+            } else {
+                // 管理员实时监控.
+                Timer::add(20, function () {
+                    // 获取在线管理员
+                    $adminList = self::$redis->smembers('adminList');
+                    if ($adminList) {
+                        self::systemMonitoring($adminList);
+                    }
+                });
+
+                // 检查对话时效给出.
+                Timer::add(40, function () {
+                    self::overTime();
+                });
+            }
         }
 
     }