|
@@ -168,7 +168,7 @@ class System extends Base
|
|
|
// 历史会话记录
|
|
// 历史会话记录
|
|
|
public function wordsLog()
|
|
public function wordsLog()
|
|
|
{
|
|
{
|
|
|
- $toExcel = input('param.toExcel', 0);
|
|
|
|
|
|
|
+// $toExcel = input('param.toExcel', 0);
|
|
|
|
|
|
|
|
if(request()->isAjax()){
|
|
if(request()->isAjax()){
|
|
|
|
|
|
|
@@ -182,7 +182,6 @@ class System extends Base
|
|
|
|
|
|
|
|
$user_id = input('param.user_id');
|
|
$user_id = input('param.user_id');
|
|
|
$group_id = input('param.group_id');
|
|
$group_id = input('param.group_id');
|
|
|
-
|
|
|
|
|
$temp = db('service_log');
|
|
$temp = db('service_log');
|
|
|
$countTmp = db('service_log');
|
|
$countTmp = db('service_log');
|
|
|
if(strlen($param['searchText'])){
|
|
if(strlen($param['searchText'])){
|
|
@@ -198,12 +197,12 @@ class System extends Base
|
|
|
//结束时间为空
|
|
//结束时间为空
|
|
|
if(!empty($start) && empty($end)){
|
|
if(!empty($start) && empty($end)){
|
|
|
$temp = $temp->where('start_time','>',strtotime($start));
|
|
$temp = $temp->where('start_time','>',strtotime($start));
|
|
|
- $countTmp = $temp->where('start_time','>',strtotime($start));
|
|
|
|
|
|
|
+ $countTmp = $countTmp->where('start_time','>',strtotime($start));
|
|
|
}
|
|
}
|
|
|
//开始时间为空
|
|
//开始时间为空
|
|
|
if(empty($start) && !empty($end)){
|
|
if(empty($start) && !empty($end)){
|
|
|
$temp = $temp->where('start_time','<',strtotime($end . ' 23:59:59'));
|
|
$temp = $temp->where('start_time','<',strtotime($end . ' 23:59:59'));
|
|
|
- $countTmp = $temp->where('start_time','<',strtotime($end . ' 23:59:59'));
|
|
|
|
|
|
|
+ $countTmp = $countTmp->where('start_time','<',strtotime($end . ' 23:59:59'));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//客服
|
|
//客服
|
|
@@ -214,12 +213,11 @@ class System extends Base
|
|
|
|
|
|
|
|
//客服组
|
|
//客服组
|
|
|
if($group_id != 0){
|
|
if($group_id != 0){
|
|
|
- $temp = $temp->where('group_id', 4);
|
|
|
|
|
- $countTmp = $temp->where('group_id', 4);
|
|
|
|
|
|
|
+ $temp = $temp->where('group_id', $group_id);
|
|
|
|
|
+ $countTmp = $countTmp->where('group_id', $group_id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$result = $temp->limit($offset, $limit)->order('start_time', 'desc')->select();
|
|
$result = $temp->limit($offset, $limit)->order('start_time', 'desc')->select();
|
|
|
- $return['total'] = $countTmp->count(); //总数据
|
|
|
|
|
|
|
|
|
|
//所有客服
|
|
//所有客服
|
|
|
$users = db('users')->select();
|
|
$users = db('users')->select();
|
|
@@ -305,17 +303,17 @@ class System extends Base
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// $return['total'] = $countTmp->count(); //总数据
|
|
|
|
|
|
|
+ $return['total'] = $countTmp->count(); //总数据
|
|
|
$return['rows'] = $result;
|
|
$return['rows'] = $result;
|
|
|
|
|
|
|
|
- if (!$toExcel) {
|
|
|
|
|
- return json($return);
|
|
|
|
|
- } else {
|
|
|
|
|
- $head = ['工单id', '访客进线时间', '接待客服', '所在组', '访客账号', '开始时间', '结束时间', '会话时长', '响应时长', '关闭原因', '满意度'];
|
|
|
|
|
- $key = ['servicelog_id', 'intime', 'kefu_name', 'group_name', 'user_name', 'start_time', 'end_time', 'conversation', 'response', 'servicelog_close_type', 'evaluate_name'];
|
|
|
|
|
- (new Office())->outdata('工作报表数据导出', $result, $head, $key);
|
|
|
|
|
- return true;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// if (!$toExcel) {
|
|
|
|
|
+// return json($return);
|
|
|
|
|
+// } else {
|
|
|
|
|
+// $head = ['工单id', '访客进线时间', '接待客服', '所在组', '访客账号', '开始时间', '结束时间', '会话时长', '响应时长', '关闭原因', '满意度'];
|
|
|
|
|
+// $key = ['servicelog_id', 'intime', 'kefu_name', 'group_name', 'user_name', 'start_time', 'end_time', 'conversation', 'response', 'servicelog_close_type', 'evaluate_name'];
|
|
|
|
|
+// (new Office())->outdata('工作报表数据导出', $result, $head, $key);
|
|
|
|
|
+// return true;
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
return json($return);
|
|
return json($return);
|
|
|
|
|
|
|
@@ -456,19 +454,23 @@ class System extends Base
|
|
|
public function toexcel()
|
|
public function toexcel()
|
|
|
{
|
|
{
|
|
|
$param = input('param.');
|
|
$param = input('param.');
|
|
|
|
|
+
|
|
|
|
|
+ $limit = $param['pageSize'];
|
|
|
|
|
+ $offset = ($param['pageNumber'] - 1) * $limit;
|
|
|
|
|
+
|
|
|
$start = $param['start'];
|
|
$start = $param['start'];
|
|
|
$end = $param['end'];
|
|
$end = $param['end'];
|
|
|
$where = [];
|
|
$where = [];
|
|
|
- if(!empty($param['user_id'])){
|
|
|
|
|
- $where['user_id'] = $param['user_id'];
|
|
|
|
|
|
|
+ if($param['user_id'] != 0){
|
|
|
|
|
+ $where['kf_id'] = $param['user_id'];
|
|
|
}
|
|
}
|
|
|
- if(!empty($param['group_id'])){
|
|
|
|
|
|
|
+ if($param['group_id'] != 0){
|
|
|
$where['group_id'] = $param['group_id'];
|
|
$where['group_id'] = $param['group_id'];
|
|
|
}
|
|
}
|
|
|
if(!empty($param['username'])){
|
|
if(!empty($param['username'])){
|
|
|
$where['user_name'] = $param['username'];
|
|
$where['user_name'] = $param['username'];
|
|
|
}
|
|
}
|
|
|
- $result = db('service_log')->whereBetween('start_time', [strtotime($start), strtotime($end . ' 23:59:59')])->where($where)->order('start_time', 'desc')->select();
|
|
|
|
|
|
|
+ $result = db('service_log')->whereBetween('start_time', [strtotime($start), strtotime($end . ' 23:59:59')])->where($where)->limit($offset, $limit)->order('start_time', 'desc')->select();
|
|
|
|
|
|
|
|
//所有客服
|
|
//所有客服
|
|
|
$users = db('users')->select();
|
|
$users = db('users')->select();
|
|
@@ -494,7 +496,7 @@ class System extends Base
|
|
|
}else{
|
|
}else{
|
|
|
$result[$key]['end_time'] = '-';
|
|
$result[$key]['end_time'] = '-';
|
|
|
}
|
|
}
|
|
|
- //客服名称
|
|
|
|
|
|
|
+ //客服昵称
|
|
|
for($i=0;$i<count($users);$i++){
|
|
for($i=0;$i<count($users);$i++){
|
|
|
if($result[$key]['kf_id'] == $users[$i]['id']){
|
|
if($result[$key]['kf_id'] == $users[$i]['id']){
|
|
|
$result[$key]['kefu_name'] = $users[$i]['user_name'];
|
|
$result[$key]['kefu_name'] = $users[$i]['user_name'];
|