ソースを参照

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

vali 6 年 前
コミット
23a8227644

+ 1 - 1
application/admin/view/settings/demo.html

@@ -20,7 +20,7 @@
   var hostname = location.protocol+'//'+location.host;
   var adminDomain = 'http://kfadmin.bocai186.com';   //服务器域名
   var serverDomain = 'http://kefu.bocai186.com';   //客服域名
-  var userDomain = 'http://kf.bocai186.com?pid='+escape("~!@#¥%……&*()——+,./;\'[]");   //用户域名
+  var userDomain = 'http://kf.bocai186.com?pid='+escape("这就是一个编码没有什么用啊");   //用户域名
   if(isIE8){
     availheight= screen.height;
   }

+ 75 - 7
application/service/controller/History.php

@@ -54,7 +54,7 @@ class History extends Common
 
             foreach ($groups as $k => $v) {
                 $data[$k]           = (object) [
-                    'label' => $v['name'],
+                    'label' => $v['name'].'-组',
                 ];
                 $n                  = 0;
                 $data[$k]->children = [];
@@ -65,23 +65,21 @@ class History extends Common
                             : ($kefuInfoData['status'] == 2 ? '(隐身)'
                                 : ($kefuInfoData['status'] == 3 ? '(休息)' : '(未知)'));
                         $data[$k]->children[$n] = (object) [
-                            'label' => $kefuInfoData['name'].$KFstatus,
+                            'label' => $kefuInfoData['name'].$KFstatus.'-客服',
                         ];
-                        $m = 0;
                         $data[$k]->children[$n]->children = [];
                         foreach ($servicelog as $val) {
                             $servicelogData = json_decode($val, true);
                             if (('KF'.$servicelogData['kf_id']) == $kefuInfoData['id']) {
                                 $found_key = array_search($servicelogData['user_id'], array_column($getAllAccounts, 'id'));
-                                $data[$k]->children[$n]->children[$m] = (object) [
-                                    'label'         => $servicelogData['user_name'],
+                                $label = $getAllAccounts[$found_key]['nick_name'] ?? $servicelogData['user_name'];
+                                $data[$k]->children[$n]->children[] = (object) [
+                                    'label'         => $label.'-会话',
                                     'user_id'         => $servicelogData['user_id'],
-                                    'nick_name'         => $getAllAccounts[$found_key]['nick_name'],
                                     'servicelog_id' => $servicelogData['servicelog_id'],
                                 ];
                             }
 
-                            $m++;
                         }
 
                         $n++;
@@ -290,6 +288,76 @@ class History extends Common
     }//end historyInfo()
 
 
+    /**
+     * 获取会话历史详细
+     *
+     * @access public
+     * @return array JsonString
+     */
+    public function chatByTime()
+    {
+        // 验证token.
+        $tokenStatus = $this->verifyToken();
+        $code        = -2;
+        $msg         = '错误';
+        if ($tokenStatus === false) {
+            $msg = 'token错误';
+            return json(['code' => $code, 'data' => [], 'msg' => $msg]);
+        }
+
+        try {
+            // 工单ID信息.
+            $servicelogId = input('get.servicelog_id');
+            $chatLogField = ['*'];
+            // 关联信息.
+            $chatLogWhere['servicelog_id'] = $servicelogId;
+            if (strlen(input('get.lastTime'))) {
+                $lastTime = input('get.lastTime');
+                $chatLogWhere['time_line']  = array('gt', $lastTime);
+            }
+            // 分页.
+            $currentPage = 1;
+            $pageSize    = 999999;
+            $offset      = (($currentPage - 1) * $pageSize);
+            $chatLog      = model('ChatLog')->selectChatLog($chatLogField, $offset, $pageSize, $chatLogWhere);
+
+            $service_log = db('service_log')->where('servicelog_id',$servicelogId)->find();
+            $account = db('accounts')
+                ->alias('a')
+                ->join('accountslabel b', 'a.label_id = b.id')
+                ->field('a.id,account_name,nick_name,account_email,account_phone,address,remark,name as label')
+                ->where('a.id',$service_log['user_id'])
+                ->find();
+            $account['user_ip'] = $service_log['user_ip'];
+            $account['system'] = $service_log['system'];
+            $account['browse'] = $service_log['browse'];
+            // 获取用户信息.
+            $usersField   = [
+                'a.id',
+                'user_name',
+                'user_avatar',
+                'b.name',
+            ];
+            // 关联信息.
+            $join['groups b']    = 'a.group_id = b.id';
+            $usersWhere['a.id'] = $service_log['kf_id'];
+            // 获取用户信息.
+            $serverInfo = model('users')->findInfo($usersField, $usersWhere, $join);
+
+
+            $result['list']        = $chatLog;
+            $result['account']    = $account;
+            $result['serverName'] = $serverInfo['user_name'];
+            $result['groupName'] = $serverInfo['name'];
+
+            return json(['code' => 1, 'data' => $result, 'msg' => '成功']);
+        } catch (\Exception $e) {
+            return json(['code' => $code, 'data' => [], 'msg' => $msg]);
+        }//end try
+
+    }//end historyInfo()
+
+
     /**
      * 获取用户会话历史详细
      *

+ 34 - 0
application/service/model/Accounts.php

@@ -0,0 +1,34 @@
+<?php
+namespace app\service\model;
+
+use think\Model;
+
+/**
+ * 用户模型
+ */
+class Accounts extends Model
+{
+
+
+    /**
+     * 数据筛选
+     *
+     * @access public
+     * @param mixed $field 字段
+     * @param mixed $where 条件
+     * @return array 返回类型
+     */
+    public function selectAccounts($field, $where=[])
+    {
+        $result = $this->field($field);
+        if (empty($where) === false) {
+            $result = $result->where($where);
+        }
+
+        $result = $result->select();
+        return $result;
+
+    }//end selectAccounts()
+
+
+}

+ 1 - 1
public/entranceJs/FloatingButton.js

@@ -10,7 +10,7 @@ var availheight = screen.availHeight;   //默认高度为屏幕的高度
 var hostname = location.protocol+'//'+location.host;
 var adminDomain = 'http://kfadmin.bocai186.com';   //服务器域名
 var serverDomain = 'http://kefu.bocai186.com';   //客服域名
-var userDomain = 'http://kf.bocai186.com?pid='+escape("~!@#¥%……&*()——+,./;\'[]");   //用户域名
+var userDomain = 'http://kf.bocai186.com?pid='+escape("这就是一个编码没有什么用啊");   //用户域名
 if(isIE8){
   availheight= screen.height;
 }

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

@@ -237,7 +237,7 @@ class Events
             return false;
         }
         $dbdata = self::$db->select('status')->from('ws_users')->where('id=:id')->bindValues(['id' => self::getkfid($kfuid)])->row();
-        if ($dbdata && $dbdata['status'] == 1) {
+        if ($dbdata && $dbdata['status'] == 1 && $kfdatas['group'] == $dbdata['group_id']) {
             return false;
         }