|
@@ -1,4 +1,5 @@
|
|
|
<?php
|
|
<?php
|
|
|
|
|
+
|
|
|
namespace app\admin\controller;
|
|
namespace app\admin\controller;
|
|
|
|
|
|
|
|
use app\admin\model\Office;
|
|
use app\admin\model\Office;
|
|
@@ -19,7 +20,7 @@ class System extends Base
|
|
|
public function basics()
|
|
public function basics()
|
|
|
{
|
|
{
|
|
|
$settings = db('settings')->find();
|
|
$settings = db('settings')->find();
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 表单提交.
|
|
// 表单提交.
|
|
|
if (request()->isPost()) {
|
|
if (request()->isPost()) {
|
|
|
$param = input('post.');
|
|
$param = input('post.');
|
|
@@ -39,7 +40,7 @@ class System extends Base
|
|
|
$updateinfo['customer_url'] = $param['customer_url'];
|
|
$updateinfo['customer_url'] = $param['customer_url'];
|
|
|
$updateinfo['backend_url'] = $param['backend_url'];
|
|
$updateinfo['backend_url'] = $param['backend_url'];
|
|
|
|
|
|
|
|
- $updateAstData['advertisement_url'] = $param['advertisementUrl'];
|
|
|
|
|
|
|
+ $updateAstData['advertisement_url'] = $param['advertisementUrl'];
|
|
|
$updateAstData['advertisement_status'] = $param['status'];
|
|
$updateAstData['advertisement_status'] = $param['status'];
|
|
|
model('Advertisement')->updateAst($updateAstData);
|
|
model('Advertisement')->updateAst($updateAstData);
|
|
|
/*// 修改系统欢迎语.
|
|
/*// 修改系统欢迎语.
|
|
@@ -48,12 +49,12 @@ class System extends Base
|
|
|
model('Reply')->updateReply($updateSysWhere, $updateSysData);*/
|
|
model('Reply')->updateReply($updateSysWhere, $updateSysData);*/
|
|
|
// 修改客服欢迎语.
|
|
// 修改客服欢迎语.
|
|
|
$updateSevData['word'] = $param['serverWord'];
|
|
$updateSevData['word'] = $param['serverWord'];
|
|
|
- $updateSevWhere['id'] = 2;
|
|
|
|
|
|
|
+ $updateSevWhere['id'] = 2;
|
|
|
model('Reply')->updateReply($updateSevWhere, $updateSevData);
|
|
model('Reply')->updateReply($updateSevWhere, $updateSevData);
|
|
|
- if(!empty($updateinfo)){
|
|
|
|
|
- db('settings')->where('id',1)->update($updateinfo);
|
|
|
|
|
- $err=$this->updateJsTmpl($updateinfo);
|
|
|
|
|
- if($err==-20003){
|
|
|
|
|
|
|
+ if (!empty($updateinfo)) {
|
|
|
|
|
+ db('settings')->where('id', 1)->update($updateinfo);
|
|
|
|
|
+ $err = $this->updateJsTmpl($updateinfo);
|
|
|
|
|
+ if ($err == -20003) {
|
|
|
return json(['code' => -2, 'data' => '', 'msg' => 'JS调用模板路径不可以写']);
|
|
return json(['code' => -2, 'data' => '', 'msg' => 'JS调用模板路径不可以写']);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -70,17 +71,17 @@ class System extends Base
|
|
|
$replySystem = model('Reply')->findReply($replySystemWhere);*/
|
|
$replySystem = model('Reply')->findReply($replySystemWhere);*/
|
|
|
// 获取客服欢迎语.
|
|
// 获取客服欢迎语.
|
|
|
$replyServerWhere['id'] = 2;
|
|
$replyServerWhere['id'] = 2;
|
|
|
- $replyServer = model('Reply')->findReply($replyServerWhere);
|
|
|
|
|
|
|
+ $replyServer = model('Reply')->findReply($replyServerWhere);
|
|
|
// 获取logo.
|
|
// 获取logo.
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
$this->assign(
|
|
$this->assign(
|
|
|
[
|
|
[
|
|
|
'advertisement' => $advertisement,
|
|
'advertisement' => $advertisement,
|
|
|
//'replySystem' => $replySystem,
|
|
//'replySystem' => $replySystem,
|
|
|
- 'replyServer' => $replyServer,
|
|
|
|
|
- 'settings' => $settings,
|
|
|
|
|
|
|
+ 'replyServer' => $replyServer,
|
|
|
|
|
+ 'settings' => $settings,
|
|
|
'socket' => config('socket'),
|
|
'socket' => config('socket'),
|
|
|
- 'status' => config('kf_status'),
|
|
|
|
|
|
|
+ 'status' => config('kf_status'),
|
|
|
]
|
|
]
|
|
|
);
|
|
);
|
|
|
|
|
|
|
@@ -88,21 +89,22 @@ class System extends Base
|
|
|
|
|
|
|
|
}//end basics()
|
|
}//end basics()
|
|
|
|
|
|
|
|
- public function updateJsTmpl($settings){
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- $src=ROOT_PATH.'public/entranceJs/jstmpl.js';
|
|
|
|
|
- $tar=ROOT_PATH.'public/entranceJs/FloatingButton.js';
|
|
|
|
|
- if(is_writable($tar) && is_readable($src)){
|
|
|
|
|
- $content=file_get_contents($src);
|
|
|
|
|
- $content=str_replace('{VISITOR_DOMAIN}',$settings['visitor_url'],$content);
|
|
|
|
|
- $content=str_replace('{CUSTOMER_DOMAIN}',$settings['customer_url'],$content);
|
|
|
|
|
- $content=str_replace('{ADMIN_DOMAIN}',$settings['backend_url'],$content);
|
|
|
|
|
- file_put_contents($tar,$content);
|
|
|
|
|
- }else{
|
|
|
|
|
|
|
+ public function updateJsTmpl($settings)
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ $src = ROOT_PATH . 'public/entranceJs/jstmpl.js';
|
|
|
|
|
+ $tar = ROOT_PATH . 'public/entranceJs/FloatingButton.js';
|
|
|
|
|
+ if (is_writable($tar) && is_readable($src)) {
|
|
|
|
|
+ $content = file_get_contents($src);
|
|
|
|
|
+ $content = str_replace('{VISITOR_DOMAIN}', $settings['visitor_url'], $content);
|
|
|
|
|
+ $content = str_replace('{CUSTOMER_DOMAIN}', $settings['customer_url'], $content);
|
|
|
|
|
+ $content = str_replace('{ADMIN_DOMAIN}', $settings['backend_url'], $content);
|
|
|
|
|
+ file_put_contents($tar, $content);
|
|
|
|
|
+ } else {
|
|
|
return -20003;
|
|
return -20003;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -114,8 +116,8 @@ class System extends Base
|
|
|
{
|
|
{
|
|
|
if (request()->isAjax()) {
|
|
if (request()->isAjax()) {
|
|
|
$replySystemWhere['type'] = 1;
|
|
$replySystemWhere['type'] = 1;
|
|
|
- $result = model('Reply')->selectReply($replySystemWhere);
|
|
|
|
|
- foreach($result as $key=>$vo){
|
|
|
|
|
|
|
+ $result = model('Reply')->selectReply($replySystemWhere);
|
|
|
|
|
+ foreach ($result as $key => $vo) {
|
|
|
// 生成操作按钮
|
|
// 生成操作按钮
|
|
|
$result[$key]['operate'] = $this->makeBotton($vo['id']);
|
|
$result[$key]['operate'] = $this->makeBotton($vo['id']);
|
|
|
$result[$key]['word'] = htmlspecialchars_decode($vo['word']);
|
|
$result[$key]['word'] = htmlspecialchars_decode($vo['word']);
|
|
@@ -138,24 +140,24 @@ class System extends Base
|
|
|
*/
|
|
*/
|
|
|
public function editWelcome()
|
|
public function editWelcome()
|
|
|
{
|
|
{
|
|
|
- if(request()->isAjax()){
|
|
|
|
|
|
|
+ if (request()->isAjax()) {
|
|
|
$param = input('post.');
|
|
$param = input('post.');
|
|
|
$where['id'] = $param['id'];
|
|
$where['id'] = $param['id'];
|
|
|
$data['sort'] = $param['sort'];
|
|
$data['sort'] = $param['sort'];
|
|
|
$data['word'] = htmlspecialchars($param['word']);
|
|
$data['word'] = htmlspecialchars($param['word']);
|
|
|
|
|
|
|
|
- try{
|
|
|
|
|
|
|
+ try {
|
|
|
model('Reply')->updateReply($where, $data);
|
|
model('Reply')->updateReply($where, $data);
|
|
|
- }catch(\Exception $e){
|
|
|
|
|
|
|
+ } catch (\Exception $e) {
|
|
|
return json(['code' => -2, 'data' => '', 'msg' => $e->getMessage()]);
|
|
return json(['code' => -2, 'data' => '', 'msg' => $e->getMessage()]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return json(['code' => 1, 'data' => '', 'msg' => '编辑成功']);
|
|
return json(['code' => 1, 'data' => '', 'msg' => '编辑成功']);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $id = input('param.id');
|
|
|
|
|
|
|
+ $id = input('param.id');
|
|
|
$replySystemWhere['id'] = $id;
|
|
$replySystemWhere['id'] = $id;
|
|
|
- $replySystem = model('Reply')->findReply($replySystemWhere);
|
|
|
|
|
|
|
+ $replySystem = model('Reply')->findReply($replySystemWhere);
|
|
|
|
|
|
|
|
$this->assign([
|
|
$this->assign([
|
|
|
'replySystem' => $replySystem,
|
|
'replySystem' => $replySystem,
|
|
@@ -193,16 +195,16 @@ class System extends Base
|
|
|
*/
|
|
*/
|
|
|
public function addWelcome()
|
|
public function addWelcome()
|
|
|
{
|
|
{
|
|
|
- if(request()->isAjax()){
|
|
|
|
|
|
|
+ if (request()->isAjax()) {
|
|
|
$param = input('post.');
|
|
$param = input('post.');
|
|
|
$data['sort'] = $param['sort'];
|
|
$data['sort'] = $param['sort'];
|
|
|
$data['word'] = htmlspecialchars($param['word']);
|
|
$data['word'] = htmlspecialchars($param['word']);
|
|
|
$data['status'] = 1;
|
|
$data['status'] = 1;
|
|
|
$data['type'] = 1;
|
|
$data['type'] = 1;
|
|
|
|
|
|
|
|
- try{
|
|
|
|
|
|
|
+ try {
|
|
|
model('Reply')->addReply($data);
|
|
model('Reply')->addReply($data);
|
|
|
- }catch(\Exception $e){
|
|
|
|
|
|
|
+ } catch (\Exception $e) {
|
|
|
return json(['code' => -2, 'data' => '', 'msg' => $e->getMessage()]);
|
|
return json(['code' => -2, 'data' => '', 'msg' => $e->getMessage()]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -230,34 +232,34 @@ class System extends Base
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
// 修改会话超时.
|
|
// 修改会话超时.
|
|
|
- $updateOvertimeData['systemconfig_data'] = $param['overtime'];
|
|
|
|
|
|
|
+ $updateOvertimeData['systemconfig_data'] = $param['overtime'];
|
|
|
$updateOvertimeData['systemconfig_content'] = $param['overtimeInfo'];
|
|
$updateOvertimeData['systemconfig_content'] = $param['overtimeInfo'];
|
|
|
- $updateOvertimeWhere['systemconfig_id'] = 1;
|
|
|
|
|
|
|
+ $updateOvertimeWhere['systemconfig_id'] = 1;
|
|
|
model('Systemconfig')->updateSystemconfig($updateOvertimeWhere, $updateOvertimeData);
|
|
model('Systemconfig')->updateSystemconfig($updateOvertimeWhere, $updateOvertimeData);
|
|
|
// 修改访客静默.
|
|
// 修改访客静默.
|
|
|
- $upUptdData['systemconfig_data'] = $param['unoperated'];
|
|
|
|
|
|
|
+ $upUptdData['systemconfig_data'] = $param['unoperated'];
|
|
|
$upUptdData['systemconfig_content'] = $param['unoperatedInfo'];
|
|
$upUptdData['systemconfig_content'] = $param['unoperatedInfo'];
|
|
|
- $upUptdWhere['systemconfig_id'] = 2;
|
|
|
|
|
|
|
+ $upUptdWhere['systemconfig_id'] = 2;
|
|
|
model('Systemconfig')->updateSystemconfig($upUptdWhere, $upUptdData);
|
|
model('Systemconfig')->updateSystemconfig($upUptdWhere, $upUptdData);
|
|
|
// 质检会话时长设置.
|
|
// 质检会话时长设置.
|
|
|
$upAllTimeData['systemconfig_data'] = $param['verifyAllTime'];
|
|
$upAllTimeData['systemconfig_data'] = $param['verifyAllTime'];
|
|
|
- $upAllTimeWhere['systemconfig_id'] = 3;
|
|
|
|
|
|
|
+ $upAllTimeWhere['systemconfig_id'] = 3;
|
|
|
model('Systemconfig')->updateSystemconfig($upAllTimeWhere, $upAllTimeData);
|
|
model('Systemconfig')->updateSystemconfig($upAllTimeWhere, $upAllTimeData);
|
|
|
// 质检会话响应时长设置.
|
|
// 质检会话响应时长设置.
|
|
|
$upReturnTimeData['systemconfig_data'] = $param['verifyReturnTime'];
|
|
$upReturnTimeData['systemconfig_data'] = $param['verifyReturnTime'];
|
|
|
- $upReturnTimeWhere['systemconfig_id'] = 4;
|
|
|
|
|
|
|
+ $upReturnTimeWhere['systemconfig_id'] = 4;
|
|
|
model('Systemconfig')->updateSystemconfig($upReturnTimeWhere, $upReturnTimeData);
|
|
model('Systemconfig')->updateSystemconfig($upReturnTimeWhere, $upReturnTimeData);
|
|
|
// 满意度评价回合限制.
|
|
// 满意度评价回合限制.
|
|
|
$upRoundData['systemconfig_data'] = $param['round'];
|
|
$upRoundData['systemconfig_data'] = $param['round'];
|
|
|
- $upRoundWhere['systemconfig_id'] = 5;
|
|
|
|
|
|
|
+ $upRoundWhere['systemconfig_id'] = 5;
|
|
|
model('Systemconfig')->updateSystemconfig($upRoundWhere, $upRoundData);
|
|
model('Systemconfig')->updateSystemconfig($upRoundWhere, $upRoundData);
|
|
|
// 客服接待人数设置.
|
|
// 客服接待人数设置.
|
|
|
$upMSWhere['systemconfig_enName'] = 'KFMaxServices';
|
|
$upMSWhere['systemconfig_enName'] = 'KFMaxServices';
|
|
|
- $upMSData['systemconfig_data'] = $param['max_service'];
|
|
|
|
|
|
|
+ $upMSData['systemconfig_data'] = $param['max_service'];
|
|
|
model('Systemconfig')->updateSystemconfig($upMSWhere, $upMSData);
|
|
model('Systemconfig')->updateSystemconfig($upMSWhere, $upMSData);
|
|
|
// 最大排队人数设置.
|
|
// 最大排队人数设置.
|
|
|
$upMWWhere['systemconfig_enName'] = 'maxWait';
|
|
$upMWWhere['systemconfig_enName'] = 'maxWait';
|
|
|
- $upMWData['systemconfig_data'] = $param['kfConfig_maxWait'];
|
|
|
|
|
|
|
+ $upMWData['systemconfig_data'] = $param['kfConfig_maxWait'];
|
|
|
model('Systemconfig')->updateSystemconfig($upMWWhere, $upMWData);
|
|
model('Systemconfig')->updateSystemconfig($upMWWhere, $upMWData);
|
|
|
|
|
|
|
|
return json(['code' => 1, 'data' => '', 'msg' => '设置成功']);
|
|
return json(['code' => 1, 'data' => '', 'msg' => '设置成功']);
|
|
@@ -271,7 +273,7 @@ class System extends Base
|
|
|
$this->assign(
|
|
$this->assign(
|
|
|
[
|
|
[
|
|
|
'systemconfig' => $systemconfig,
|
|
'systemconfig' => $systemconfig,
|
|
|
- 'status' => config('kf_status'),
|
|
|
|
|
|
|
+ 'status' => config('kf_status'),
|
|
|
'socket' => config('socket'),
|
|
'socket' => config('socket'),
|
|
|
]
|
|
]
|
|
|
);
|
|
);
|
|
@@ -284,16 +286,16 @@ class System extends Base
|
|
|
// 自动回复设置
|
|
// 自动回复设置
|
|
|
public function reply()
|
|
public function reply()
|
|
|
{
|
|
{
|
|
|
- if(request()->isPost()){
|
|
|
|
|
|
|
+ if (request()->isPost()) {
|
|
|
|
|
|
|
|
$param = input('post.');
|
|
$param = input('post.');
|
|
|
- if(empty($param['word'])){
|
|
|
|
|
|
|
+ if (empty($param['word'])) {
|
|
|
return json(['code' => -1, 'data' => '', 'msg' => '回复内容不能为空']);
|
|
return json(['code' => -1, 'data' => '', 'msg' => '回复内容不能为空']);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- try{
|
|
|
|
|
|
|
+ try {
|
|
|
db('reply')->where('id', 1)->update($param);
|
|
db('reply')->where('id', 1)->update($param);
|
|
|
- }catch(\Exception $e){
|
|
|
|
|
|
|
+ } catch (\Exception $e) {
|
|
|
return json(['code' => -2, 'data' => '', 'msg' => $e->getMessage()]);
|
|
return json(['code' => -2, 'data' => '', 'msg' => $e->getMessage()]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -315,7 +317,7 @@ class System extends Base
|
|
|
{
|
|
{
|
|
|
// $toExcel = input('param.toExcel', 0);
|
|
// $toExcel = input('param.toExcel', 0);
|
|
|
|
|
|
|
|
- if(request()->isAjax()){
|
|
|
|
|
|
|
+ if (request()->isAjax()) {
|
|
|
$param = input('param.');
|
|
$param = input('param.');
|
|
|
$limit = $param['pageSize'];
|
|
$limit = $param['pageSize'];
|
|
|
$offset = ($param['pageNumber'] - 1) * $limit;
|
|
$offset = ($param['pageNumber'] - 1) * $limit;
|
|
@@ -327,35 +329,35 @@ class System extends Base
|
|
|
$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'])){
|
|
|
|
|
- $temp = $temp->whereLike('user_name', '%'.$param['searchText'].'%');
|
|
|
|
|
- $countTmp = $countTmp->whereLike('user_name', '%'.$param['searchText'].'%');
|
|
|
|
|
|
|
+ if (strlen($param['searchText'])) {
|
|
|
|
|
+ $temp = $temp->whereLike('user_name', '%' . $param['searchText'] . '%');
|
|
|
|
|
+ $countTmp = $countTmp->whereLike('user_name', '%' . $param['searchText'] . '%');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//日期
|
|
//日期
|
|
|
- if(!empty($start) && !empty($end) && $start <= $end){
|
|
|
|
|
|
|
+ if (!empty($start) && !empty($end) && $start <= $end) {
|
|
|
$temp = $temp->whereBetween('start_time', [strtotime($start), strtotime($end . ' 23:59:59')]);
|
|
$temp = $temp->whereBetween('start_time', [strtotime($start), strtotime($end . ' 23:59:59')]);
|
|
|
$countTmp = $countTmp->whereBetween('start_time', [strtotime($start), strtotime($end . ' 23:59:59')]);
|
|
$countTmp = $countTmp->whereBetween('start_time', [strtotime($start), strtotime($end . ' 23:59:59')]);
|
|
|
}
|
|
}
|
|
|
//结束时间为空
|
|
//结束时间为空
|
|
|
- if(!empty($start) && empty($end)){
|
|
|
|
|
- $temp = $temp->where('start_time','>',strtotime($start));
|
|
|
|
|
- $countTmp = $countTmp->where('start_time','>',strtotime($start));
|
|
|
|
|
|
|
+ if (!empty($start) && empty($end)) {
|
|
|
|
|
+ $temp = $temp->where('start_time', '>', strtotime($start));
|
|
|
|
|
+ $countTmp = $countTmp->where('start_time', '>', strtotime($start));
|
|
|
}
|
|
}
|
|
|
//开始时间为空
|
|
//开始时间为空
|
|
|
- if(empty($start) && !empty($end)){
|
|
|
|
|
- $temp = $temp->where('start_time','<',strtotime($end . ' 23:59:59'));
|
|
|
|
|
- $countTmp = $countTmp->where('start_time','<',strtotime($end . ' 23:59:59'));
|
|
|
|
|
|
|
+ if (empty($start) && !empty($end)) {
|
|
|
|
|
+ $temp = $temp->where('start_time', '<', strtotime($end . ' 23:59:59'));
|
|
|
|
|
+ $countTmp = $countTmp->where('start_time', '<', strtotime($end . ' 23:59:59'));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//客服
|
|
//客服
|
|
|
- if($user_id != 0){
|
|
|
|
|
|
|
+ if ($user_id != 0) {
|
|
|
$temp = $temp->where('kf_id', $user_id);
|
|
$temp = $temp->where('kf_id', $user_id);
|
|
|
$countTmp = $countTmp->where('kf_id', $user_id);
|
|
$countTmp = $countTmp->where('kf_id', $user_id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//客服组
|
|
//客服组
|
|
|
- if($group_id != 0){
|
|
|
|
|
|
|
+ if ($group_id != 0) {
|
|
|
$temp = $temp->where('group_id', $group_id);
|
|
$temp = $temp->where('group_id', $group_id);
|
|
|
$countTmp = $countTmp->where('group_id', $group_id);
|
|
$countTmp = $countTmp->where('group_id', $group_id);
|
|
|
}
|
|
}
|
|
@@ -369,121 +371,121 @@ class System extends Base
|
|
|
//满意度
|
|
//满意度
|
|
|
$evaluate = db('evaluate')->select();
|
|
$evaluate = db('evaluate')->select();
|
|
|
//$alarm报警信息
|
|
//$alarm报警信息
|
|
|
- $alarm = db('alarm')->select();
|
|
|
|
|
- foreach($result as $key=>$vo){
|
|
|
|
|
- if($result[$key]['intime'] != 0){
|
|
|
|
|
|
|
+ $alarm = db('alarm')->select();
|
|
|
|
|
+ foreach ($result as $key => $vo) {
|
|
|
|
|
+ if ($result[$key]['intime'] != 0) {
|
|
|
$result[$key]['intime'] = date('Y-m-d H:i:s', $vo['intime']);
|
|
$result[$key]['intime'] = date('Y-m-d H:i:s', $vo['intime']);
|
|
|
|
|
|
|
|
- $date = explode(' ',$result[$key]['intime']);
|
|
|
|
|
- $year = explode('-',$result[$key]['intime']);
|
|
|
|
|
- if($date[0] == date('Y-m-d',time())){
|
|
|
|
|
- $result[$key]['intime'] = '<span style="float: right;">'.$date[1].'</span>';
|
|
|
|
|
- }else if($date[0] == date('Y-m-d',strtotime("-1 day"))){
|
|
|
|
|
- $result[$key]['intime'] = '<span style="float: right;">'.'昨天 '.$date[1].'</span>';
|
|
|
|
|
- }else{
|
|
|
|
|
- if($year[0] == date('Y',time())){
|
|
|
|
|
- $result[$key]['intime'] = '<span style="float: right;">'.date('m-d H:i:s',strtotime($result[$key]['intime'])).'</span>';
|
|
|
|
|
|
|
+ $date = explode(' ', $result[$key]['intime']);
|
|
|
|
|
+ $year = explode('-', $result[$key]['intime']);
|
|
|
|
|
+ if ($date[0] == date('Y-m-d', time())) {
|
|
|
|
|
+ $result[$key]['intime'] = '<span style="float: right;">' . $date[1] . '</span>';
|
|
|
|
|
+ } else if ($date[0] == date('Y-m-d', strtotime("-1 day"))) {
|
|
|
|
|
+ $result[$key]['intime'] = '<span style="float: right;">' . '昨天 ' . $date[1] . '</span>';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if ($year[0] == date('Y', time())) {
|
|
|
|
|
+ $result[$key]['intime'] = '<span style="float: right;">' . date('m-d H:i:s', strtotime($result[$key]['intime'])) . '</span>';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
$result[$key]['intime'] = '-';
|
|
$result[$key]['intime'] = '-';
|
|
|
}
|
|
}
|
|
|
- if($result[$key]['start_time'] != 0){
|
|
|
|
|
|
|
+ if ($result[$key]['start_time'] != 0) {
|
|
|
$result[$key]['start_time'] = date('Y-m-d H:i:s', $vo['start_time']);
|
|
$result[$key]['start_time'] = date('Y-m-d H:i:s', $vo['start_time']);
|
|
|
|
|
|
|
|
- $date = explode(' ',$result[$key]['start_time']);
|
|
|
|
|
- $year = explode('-',$result[$key]['start_time']);
|
|
|
|
|
- if($date[0] == date('Y-m-d',time())){
|
|
|
|
|
- $result[$key]['start_time'] = '<span style="float: right;">'.$date[1].'</span>';
|
|
|
|
|
- }else if($date[0] == date('Y-m-d',strtotime("-1 day"))){
|
|
|
|
|
- $result[$key]['start_time'] = '<span style="float: right;">'.'昨天 '.$date[1].'</span>';
|
|
|
|
|
- }else{
|
|
|
|
|
- if($year[0] == date('Y',time())){
|
|
|
|
|
- $result[$key]['start_time'] = '<span style="float: right;">'.date('m-d H:i:s',strtotime($result[$key]['start_time'])).'</span>';
|
|
|
|
|
|
|
+ $date = explode(' ', $result[$key]['start_time']);
|
|
|
|
|
+ $year = explode('-', $result[$key]['start_time']);
|
|
|
|
|
+ if ($date[0] == date('Y-m-d', time())) {
|
|
|
|
|
+ $result[$key]['start_time'] = '<span style="float: right;">' . $date[1] . '</span>';
|
|
|
|
|
+ } else if ($date[0] == date('Y-m-d', strtotime("-1 day"))) {
|
|
|
|
|
+ $result[$key]['start_time'] = '<span style="float: right;">' . '昨天 ' . $date[1] . '</span>';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if ($year[0] == date('Y', time())) {
|
|
|
|
|
+ $result[$key]['start_time'] = '<span style="float: right;">' . date('m-d H:i:s', strtotime($result[$key]['start_time'])) . '</span>';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
$result[$key]['start_time'] = '-';
|
|
$result[$key]['start_time'] = '-';
|
|
|
}
|
|
}
|
|
|
- if($result[$key]['end_time'] != 0){
|
|
|
|
|
|
|
+ if ($result[$key]['end_time'] != 0) {
|
|
|
$result[$key]['end_time'] = date('Y-m-d H:i:s', $vo['end_time']);
|
|
$result[$key]['end_time'] = date('Y-m-d H:i:s', $vo['end_time']);
|
|
|
|
|
|
|
|
- $date = explode(' ',$result[$key]['end_time']);
|
|
|
|
|
- $year = explode('-',$result[$key]['end_time']);
|
|
|
|
|
- if($date[0] == date('Y-m-d',time())){
|
|
|
|
|
- $result[$key]['end_time'] = '<span style="float: right;">'.$date[1].'</span>';
|
|
|
|
|
- }else if($date[0] == date('Y-m-d',strtotime("-1 day"))){
|
|
|
|
|
- $result[$key]['end_time'] = '<span style="float: right;">'.'昨天 '.$date[1].'</span>';
|
|
|
|
|
- }else{
|
|
|
|
|
- if($year[0] == date('Y',time())){
|
|
|
|
|
- $result[$key]['end_time'] = '<span style="float: right;">'.date('m-d H:i:s',strtotime($result[$key]['end_time'])).'</span>';
|
|
|
|
|
|
|
+ $date = explode(' ', $result[$key]['end_time']);
|
|
|
|
|
+ $year = explode('-', $result[$key]['end_time']);
|
|
|
|
|
+ if ($date[0] == date('Y-m-d', time())) {
|
|
|
|
|
+ $result[$key]['end_time'] = '<span style="float: right;">' . $date[1] . '</span>';
|
|
|
|
|
+ } else if ($date[0] == date('Y-m-d', strtotime("-1 day"))) {
|
|
|
|
|
+ $result[$key]['end_time'] = '<span style="float: right;">' . '昨天 ' . $date[1] . '</span>';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if ($year[0] == date('Y', time())) {
|
|
|
|
|
+ $result[$key]['end_time'] = '<span style="float: right;">' . date('m-d H:i:s', strtotime($result[$key]['end_time'])) . '</span>';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
$result[$key]['end_time'] = '-';
|
|
$result[$key]['end_time'] = '-';
|
|
|
}
|
|
}
|
|
|
//客服名称
|
|
//客服名称
|
|
|
- for($i=0;$i<count($users);$i++){
|
|
|
|
|
- if($result[$key]['kf_id'] == $users[$i]['id']){
|
|
|
|
|
|
|
+ for ($i = 0; $i < count($users); $i++) {
|
|
|
|
|
+ if ($result[$key]['kf_id'] == $users[$i]['id']) {
|
|
|
$result[$key]['kefu_name'] = $users[$i]['user_name'];
|
|
$result[$key]['kefu_name'] = $users[$i]['user_name'];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//满意度
|
|
//满意度
|
|
|
- for($j=0;$j<count($evaluate);$j++){
|
|
|
|
|
- if($result[$key]['evaluate_id'] == $evaluate[$j]['evaluate_id']){
|
|
|
|
|
|
|
+ for ($j = 0; $j < count($evaluate); $j++) {
|
|
|
|
|
+ if ($result[$key]['evaluate_id'] == $evaluate[$j]['evaluate_id']) {
|
|
|
$result[$key]['evaluate_name'] = $evaluate[$j]['evaluate_name'];
|
|
$result[$key]['evaluate_name'] = $evaluate[$j]['evaluate_name'];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//客服所在组
|
|
//客服所在组
|
|
|
- for($a=0;$a<count($groups);$a++){
|
|
|
|
|
- if($result[$key]['group_id'] == $groups[$a]['id']){
|
|
|
|
|
|
|
+ for ($a = 0; $a < count($groups); $a++) {
|
|
|
|
|
+ if ($result[$key]['group_id'] == $groups[$a]['id']) {
|
|
|
$result[$key]['group_name'] = $groups[$a]['name'];
|
|
$result[$key]['group_name'] = $groups[$a]['name'];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//会话时长/响应时长
|
|
//会话时长/响应时长
|
|
|
- for($b=0;$b<count($alarm);$b++){
|
|
|
|
|
- if($result[$key]['servicelog_id'] == $alarm[$b]['servicelog_id']){
|
|
|
|
|
|
|
+ for ($b = 0; $b < count($alarm); $b++) {
|
|
|
|
|
+ if ($result[$key]['servicelog_id'] == $alarm[$b]['servicelog_id']) {
|
|
|
//会话时长
|
|
//会话时长
|
|
|
- $conversation_min = intval($alarm[$b]['alarm_cvtOvertime']/60);
|
|
|
|
|
- $conversation_s = $alarm[$b]['alarm_cvtOvertime']%60;
|
|
|
|
|
- $result[$key]['conversation'] = $conversation_min.'分'.$conversation_s.'秒';
|
|
|
|
|
|
|
+ $conversation_min = intval($alarm[$b]['alarm_cvtOvertime'] / 60);
|
|
|
|
|
+ $conversation_s = $alarm[$b]['alarm_cvtOvertime'] % 60;
|
|
|
|
|
+ $result[$key]['conversation'] = $conversation_min . '分' . $conversation_s . '秒';
|
|
|
//响应时长
|
|
//响应时长
|
|
|
- $response_min = intval($alarm[$b]['alarm_corresponding']/60);
|
|
|
|
|
- $response_s = $alarm[$b]['alarm_corresponding']%60;
|
|
|
|
|
- $result[$key]['response'] = $response_min.'分'.$response_s.'秒';
|
|
|
|
|
|
|
+ $response_min = intval($alarm[$b]['alarm_corresponding'] / 60);
|
|
|
|
|
+ $response_s = $alarm[$b]['alarm_corresponding'] % 60;
|
|
|
|
|
+ $result[$key]['response'] = $response_min . '分' . $response_s . '秒';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if($vo['servicelog_close_type'] == 0){
|
|
|
|
|
|
|
+ if ($vo['servicelog_close_type'] == 0) {
|
|
|
$result[$key]['servicelog_close_type'] = '未知';
|
|
$result[$key]['servicelog_close_type'] = '未知';
|
|
|
}
|
|
}
|
|
|
- if($vo['servicelog_close_type'] == 1){
|
|
|
|
|
|
|
+ if ($vo['servicelog_close_type'] == 1) {
|
|
|
$result[$key]['servicelog_close_type'] = '无效会话';
|
|
$result[$key]['servicelog_close_type'] = '无效会话';
|
|
|
}
|
|
}
|
|
|
- if($vo['servicelog_close_type'] == 2){
|
|
|
|
|
|
|
+ if ($vo['servicelog_close_type'] == 2) {
|
|
|
$result[$key]['servicelog_close_type'] = '双方静默';
|
|
$result[$key]['servicelog_close_type'] = '双方静默';
|
|
|
}
|
|
}
|
|
|
- if($vo['servicelog_close_type'] == 3){
|
|
|
|
|
|
|
+ if ($vo['servicelog_close_type'] == 3) {
|
|
|
$result[$key]['servicelog_close_type'] = '客服关闭';
|
|
$result[$key]['servicelog_close_type'] = '客服关闭';
|
|
|
}
|
|
}
|
|
|
- if($vo['servicelog_close_type'] == 4){
|
|
|
|
|
|
|
+ if ($vo['servicelog_close_type'] == 4) {
|
|
|
$result[$key]['servicelog_close_type'] = '客服掉线';
|
|
$result[$key]['servicelog_close_type'] = '客服掉线';
|
|
|
}
|
|
}
|
|
|
- if($vo['servicelog_close_type'] == 5){
|
|
|
|
|
|
|
+ if ($vo['servicelog_close_type'] == 5) {
|
|
|
$result[$key]['servicelog_close_type'] = '转出';
|
|
$result[$key]['servicelog_close_type'] = '转出';
|
|
|
}
|
|
}
|
|
|
- if($vo['servicelog_close_type'] == 6){
|
|
|
|
|
|
|
+ if ($vo['servicelog_close_type'] == 6) {
|
|
|
$result[$key]['servicelog_close_type'] = '用户关闭';
|
|
$result[$key]['servicelog_close_type'] = '用户关闭';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 生成操作按钮
|
|
// 生成操作按钮
|
|
|
- if(0 != $vo['servicelog_id']){
|
|
|
|
|
|
|
+ if (0 != $vo['servicelog_id']) {
|
|
|
$result[$key]['operate'] = $this->makeBtn($vo['servicelog_id']);
|
|
$result[$key]['operate'] = $this->makeBtn($vo['servicelog_id']);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -506,22 +508,22 @@ class System extends Base
|
|
|
//所有客服
|
|
//所有客服
|
|
|
$users = db('users')->select();
|
|
$users = db('users')->select();
|
|
|
$useroption = '';
|
|
$useroption = '';
|
|
|
- if(!empty($users)){
|
|
|
|
|
|
|
+ if (!empty($users)) {
|
|
|
$option = '<option value="0">全部客服</option>';
|
|
$option = '<option value="0">全部客服</option>';
|
|
|
- for($i=0;$i<count($users);$i++){
|
|
|
|
|
- $option = $option.'<option value="'.$users[$i]['id'].'">'.$users[$i]['user_name'].'</option>';
|
|
|
|
|
|
|
+ for ($i = 0; $i < count($users); $i++) {
|
|
|
|
|
+ $option = $option . '<option value="' . $users[$i]['id'] . '">' . $users[$i]['user_name'] . '</option>';
|
|
|
}
|
|
}
|
|
|
- $useroption = '<select class="selector_user" lay-verify="required" lay-filter="user_id" style="height: 30px;">'.$option.'</select>';
|
|
|
|
|
|
|
+ $useroption = '<select class="selector_user" lay-verify="required" lay-filter="user_id" style="height: 30px;">' . $option . '</select>';
|
|
|
}
|
|
}
|
|
|
//所有客服组
|
|
//所有客服组
|
|
|
$groups = db('groups')->select();
|
|
$groups = db('groups')->select();
|
|
|
$groupoption = '';
|
|
$groupoption = '';
|
|
|
- if(!empty($groups)){
|
|
|
|
|
|
|
+ if (!empty($groups)) {
|
|
|
$option = '<option value="0">全部客服组</option>';
|
|
$option = '<option value="0">全部客服组</option>';
|
|
|
- for($j=0;$j<count($groups);$j++){
|
|
|
|
|
- $option = $option.'<option value="'.$groups[$j]['id'].'">'.$groups[$j]['name'].'</option>';
|
|
|
|
|
|
|
+ for ($j = 0; $j < count($groups); $j++) {
|
|
|
|
|
+ $option = $option . '<option value="' . $groups[$j]['id'] . '">' . $groups[$j]['name'] . '</option>';
|
|
|
}
|
|
}
|
|
|
- $groupoption = '<select class="selector_group" lay-verify="required" lay-filter="group_id" style="height: 30px;">'.$option.'</select>';
|
|
|
|
|
|
|
+ $groupoption = '<select class="selector_group" lay-verify="required" lay-filter="group_id" style="height: 30px;">' . $option . '</select>';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$this->assign([
|
|
$this->assign([
|
|
@@ -534,39 +536,39 @@ class System extends Base
|
|
|
|
|
|
|
|
function matching($str, $a, $b)
|
|
function matching($str, $a, $b)
|
|
|
{
|
|
{
|
|
|
- $pattern = '/('.$a.')(.*)(?)('.$b.')/'; //正则规则匹配支付串中任何一个位置字符串
|
|
|
|
|
|
|
+ $pattern = '/(' . $a . ')(.*)(?)(' . $b . ')/'; //正则规则匹配支付串中任何一个位置字符串
|
|
|
//$pattern = '/(#\[)(.*)(?)(\]\/)/';
|
|
//$pattern = '/(#\[)(.*)(?)(\]\/)/';
|
|
|
- preg_match_all($pattern,$str,$m);
|
|
|
|
|
|
|
+ preg_match_all($pattern, $str, $m);
|
|
|
//preg_match_all($pattern, $str, $m); //返回一个匹配结果
|
|
//preg_match_all($pattern, $str, $m); //返回一个匹配结果
|
|
|
//print_r($m);die; //到时候在这里书写返回值就好了 .die;
|
|
//print_r($m);die; //到时候在这里书写返回值就好了 .die;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 历史会话记录详情
|
|
// 历史会话记录详情
|
|
|
- public function detail($id, $type='')
|
|
|
|
|
|
|
+ public function detail($id, $type = '')
|
|
|
{
|
|
{
|
|
|
- $chat = db('chat_log')->where('servicelog_id',$id)->order('time_line')->select();
|
|
|
|
|
|
|
+ $chat = db('chat_log')->where('servicelog_id', $id)->order('time_line')->select();
|
|
|
$html = '';
|
|
$html = '';
|
|
|
- for($i=0;$i<count($chat);$i++){
|
|
|
|
|
|
|
+ for ($i = 0; $i < count($chat); $i++) {
|
|
|
$content = json_decode($chat[$i]['content'], true);
|
|
$content = json_decode($chat[$i]['content'], true);
|
|
|
- $chat[$i]['time_line'] = date('H:i',$chat[$i]['time_line']);
|
|
|
|
|
- if(!empty($content['text'])){
|
|
|
|
|
- $content['content'] = '  '.$content['text'].'  ';
|
|
|
|
|
|
|
+ $chat[$i]['time_line'] = date('H:i', $chat[$i]['time_line']);
|
|
|
|
|
+ if (!empty($content['text'])) {
|
|
|
|
|
+ $content['content'] = '  ' . $content['text'] . '  ';
|
|
|
}
|
|
}
|
|
|
- if(!empty($content['img'])){
|
|
|
|
|
- $content['content'] = '<img width="100%" src="'.$content['img'].'"/>';
|
|
|
|
|
|
|
+ if (!empty($content['img'])) {
|
|
|
|
|
+ $content['content'] = '<img width="100%" src="' . $content['img'] . '"/>';
|
|
|
}
|
|
}
|
|
|
- if(!empty(strstr($chat[$i]['to_id'], 'KF'))){
|
|
|
|
|
|
|
+ if (!empty(strstr($chat[$i]['to_id'], 'KF'))) {
|
|
|
/*$preg1 = "/^#[*]$/";
|
|
/*$preg1 = "/^#[*]$/";
|
|
|
$preg= '/xue[\s\S]*?om/i';
|
|
$preg= '/xue[\s\S]*?om/i';
|
|
|
preg_match_all($preg1,"#[哈哈]/",$res);
|
|
preg_match_all($preg1,"#[哈哈]/",$res);
|
|
|
var_dump($res);*/
|
|
var_dump($res);*/
|
|
|
- $this->matching("#[哈哈]/","#\[","\]\/");
|
|
|
|
|
|
|
+ $this->matching("#[哈哈]/", "#\[", "\]\/");
|
|
|
//$this->getFacesIcon();
|
|
//$this->getFacesIcon();
|
|
|
- $html = $html . '<div style="margin-top:15px;width:75%"><div>'.$chat[$i]['from_name'].'   '.$chat[$i]['time_line'].'</div>';
|
|
|
|
|
- $html = $html . '<div style="margin-top:5px;display:inline-block;*display:inline;*zoom:1;word-break:break-all;word-wrap:break-word" class="form-content">'.$content['content'].'</div></div>';
|
|
|
|
|
- }else{
|
|
|
|
|
- $html = $html . '<div style="margin-top:15px;width:75%;margin-left:25%;text-align:right;"><div>'.$chat[$i]['from_name'].'   '.$chat[$i]['time_line'].'</div>';
|
|
|
|
|
- $html = $html . '<div style="margin-top:5px;display:inline-block;*display:inline;*zoom:1;text-align:left;word-break:break-all;word-wrap:break-word" class="form-content">'.$content['content'].'</div></div>';
|
|
|
|
|
|
|
+ $html = $html . '<div style="margin-top:15px;width:75%"><div>' . $chat[$i]['from_name'] . '   ' . $chat[$i]['time_line'] . '</div>';
|
|
|
|
|
+ $html = $html . '<div style="margin-top:5px;display:inline-block;*display:inline;*zoom:1;word-break:break-all;word-wrap:break-word" class="form-content">' . $content['content'] . '</div></div>';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $html = $html . '<div style="margin-top:15px;width:75%;margin-left:25%;text-align:right;"><div>' . $chat[$i]['from_name'] . '   ' . $chat[$i]['time_line'] . '</div>';
|
|
|
|
|
+ $html = $html . '<div style="margin-top:5px;display:inline-block;*display:inline;*zoom:1;text-align:left;word-break:break-all;word-wrap:break-word" class="form-content">' . $content['content'] . '</div></div>';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -574,47 +576,47 @@ class System extends Base
|
|
|
if ($type === 'onLine') {
|
|
if ($type === 'onLine') {
|
|
|
$servicelog = json_decode($redis->handler()->Hget('SERVICELOG', $id), true);
|
|
$servicelog = json_decode($redis->handler()->Hget('SERVICELOG', $id), true);
|
|
|
} else {
|
|
} else {
|
|
|
- $servicelog = db('service_log')->where('servicelog_id',$id)->find();
|
|
|
|
|
|
|
+ $servicelog = db('service_log')->where('servicelog_id', $id)->find();
|
|
|
}
|
|
}
|
|
|
//满意度
|
|
//满意度
|
|
|
- $evaluate = db('evaluate')->where('evaluate_id',$servicelog['evaluate_id'])->find();
|
|
|
|
|
- $evaluate = '<img width="40px" style="margin-top:15px;" src="'.$evaluate['evaluate_url'].'"/>';
|
|
|
|
|
|
|
+ $evaluate = db('evaluate')->where('evaluate_id', $servicelog['evaluate_id'])->find();
|
|
|
|
|
+ $evaluate = '<img width="40px" style="margin-top:15px;" src="' . $evaluate['evaluate_url'] . '"/>';
|
|
|
|
|
|
|
|
//$alarm报警信息
|
|
//$alarm报警信息
|
|
|
if ($type === 'onLine') {
|
|
if ($type === 'onLine') {
|
|
|
$alarm = json_decode($redis->handler()->Hget('SERVICELOG', $id), true);
|
|
$alarm = json_decode($redis->handler()->Hget('SERVICELOG', $id), true);
|
|
|
} else {
|
|
} else {
|
|
|
- $alarm = db('alarm')->where('servicelog_id',$id)->find();
|
|
|
|
|
|
|
+ $alarm = db('alarm')->where('servicelog_id', $id)->find();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//会话超时标准
|
|
//会话超时标准
|
|
|
- $verifyAllTime = db('systemconfig')->where('systemconfig_name','质检会话时长设置')->find();
|
|
|
|
|
|
|
+ $verifyAllTime = db('systemconfig')->where('systemconfig_name', '质检会话时长设置')->find();
|
|
|
//会话响应时长标准
|
|
//会话响应时长标准
|
|
|
- $verifyReturnTime = db('systemconfig')->where('systemconfig_name','质检会话响应时长设置')->find();
|
|
|
|
|
|
|
+ $verifyReturnTime = db('systemconfig')->where('systemconfig_name', '质检会话响应时长设置')->find();
|
|
|
$span = '';
|
|
$span = '';
|
|
|
- if(!empty($alarm)){
|
|
|
|
|
- if($alarm['alarm_userSensitive'] != 0){
|
|
|
|
|
|
|
+ if (!empty($alarm)) {
|
|
|
|
|
+ if ($alarm['alarm_userSensitive'] != 0) {
|
|
|
$span = $span . '<span class="alarm_info">访客敏感词</span>';
|
|
$span = $span . '<span class="alarm_info">访客敏感词</span>';
|
|
|
}
|
|
}
|
|
|
- if($alarm['alarm_serverSensitive'] != 0){
|
|
|
|
|
|
|
+ if ($alarm['alarm_serverSensitive'] != 0) {
|
|
|
$span = $span . '<span class="alarm_info">客服敏感词</span>';
|
|
$span = $span . '<span class="alarm_info">客服敏感词</span>';
|
|
|
}
|
|
}
|
|
|
- if($alarm['alarm_corresponding'] > $verifyReturnTime['systemconfig_data']){
|
|
|
|
|
|
|
+ if ($alarm['alarm_corresponding'] > $verifyReturnTime['systemconfig_data']) {
|
|
|
$span = $span . '<span class="alarm_info">响应超时</span>';
|
|
$span = $span . '<span class="alarm_info">响应超时</span>';
|
|
|
}
|
|
}
|
|
|
- if($alarm['alarm_cvtOvertime'] > $verifyAllTime['systemconfig_data']){
|
|
|
|
|
|
|
+ if ($alarm['alarm_cvtOvertime'] > $verifyAllTime['systemconfig_data']) {
|
|
|
$span = $span . '<span class="alarm_info">会话超时</span>';
|
|
$span = $span . '<span class="alarm_info">会话超时</span>';
|
|
|
}
|
|
}
|
|
|
- if($alarm['alarm_respond'] == 1){
|
|
|
|
|
|
|
+ if ($alarm['alarm_respond'] == 1) {
|
|
|
$span = $span . '<span class="alarm_info">客服未回应</span>';
|
|
$span = $span . '<span class="alarm_info">客服未回应</span>';
|
|
|
}
|
|
}
|
|
|
- if($alarm['alarm_count'] == 0 && $type !== 'onLine'){
|
|
|
|
|
|
|
+ if ($alarm['alarm_count'] == 0 && $type !== 'onLine') {
|
|
|
$span = $span . '<span class="alarm_info">会话无内容</span>';
|
|
$span = $span . '<span class="alarm_info">会话无内容</span>';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//用户信息
|
|
//用户信息
|
|
|
- $account = db('accounts')->where('id',$servicelog['user_id'])->find();
|
|
|
|
|
|
|
+ $account = db('accounts')->where('id', $servicelog['user_id'])->find();
|
|
|
$label = db('accountslabel')->where('id', $account['label_id'])->find();
|
|
$label = db('accountslabel')->where('id', $account['label_id'])->find();
|
|
|
$account['label'] = $label['name'];
|
|
$account['label'] = $label['name'];
|
|
|
$this->assign([
|
|
$this->assign([
|
|
@@ -637,7 +639,8 @@ class System extends Base
|
|
|
return $operate;
|
|
return $operate;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function getFacesIcon($facesIcon) {
|
|
|
|
|
|
|
+ public function getFacesIcon($facesIcon)
|
|
|
|
|
+ {
|
|
|
$data = ["[微笑]", "[嘻嘻]", "[哈哈]", "[可爱]", "[可怜]", "[挖鼻]", "[吃惊]", "[害羞]", "[挤眼]", "[闭嘴]", "[鄙视]",
|
|
$data = ["[微笑]", "[嘻嘻]", "[哈哈]", "[可爱]", "[可怜]", "[挖鼻]", "[吃惊]", "[害羞]", "[挤眼]", "[闭嘴]", "[鄙视]",
|
|
|
"[爱你]", "[泪]", "[偷笑]", "[亲亲]", "[生病]", "[太开心]", "[白眼]", "[右哼哼]", "[左哼哼]", "[嘘]", "[衰]",
|
|
"[爱你]", "[泪]", "[偷笑]", "[亲亲]", "[生病]", "[太开心]", "[白眼]", "[右哼哼]", "[左哼哼]", "[嘘]", "[衰]",
|
|
|
"[委屈]", "[吐]", "[哈欠]", "[抱抱]", "[怒]", "[疑问]", "[馋嘴]", "[拜拜]", "[思考]", "[汗]", "[困]", "[睡]",
|
|
"[委屈]", "[吐]", "[哈欠]", "[抱抱]", "[怒]", "[疑问]", "[馋嘴]", "[拜拜]", "[思考]", "[汗]", "[困]", "[睡]",
|
|
@@ -660,13 +663,13 @@ class System extends Base
|
|
|
$start = $param['start'];
|
|
$start = $param['start'];
|
|
|
$end = $param['end'];
|
|
$end = $param['end'];
|
|
|
$where = [];
|
|
$where = [];
|
|
|
- if($param['user_id'] != 0){
|
|
|
|
|
|
|
+ if ($param['user_id'] != 0) {
|
|
|
$where['kf_id'] = $param['user_id'];
|
|
$where['kf_id'] = $param['user_id'];
|
|
|
}
|
|
}
|
|
|
- if($param['group_id'] != 0){
|
|
|
|
|
|
|
+ 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)->order('start_time', 'desc')->select();
|
|
@@ -678,69 +681,69 @@ class System extends Base
|
|
|
//满意度
|
|
//满意度
|
|
|
$evaluate = db('evaluate')->select();
|
|
$evaluate = db('evaluate')->select();
|
|
|
//$alarm报警信息
|
|
//$alarm报警信息
|
|
|
- $alarm = db('alarm')->select();
|
|
|
|
|
|
|
+ $alarm = db('alarm')->select();
|
|
|
//会话超时标准
|
|
//会话超时标准
|
|
|
- $verifyAllTime = db('systemconfig')->where('systemconfig_name','质检会话时长设置')->find();
|
|
|
|
|
|
|
+ $verifyAllTime = db('systemconfig')->where('systemconfig_name', '质检会话时长设置')->find();
|
|
|
//会话响应时长标准
|
|
//会话响应时长标准
|
|
|
- $verifyReturnTime = db('systemconfig')->where('systemconfig_name','质检会话响应时长设置')->find();
|
|
|
|
|
- for($c=0;$c<count($alarm);$c++){
|
|
|
|
|
|
|
+ $verifyReturnTime = db('systemconfig')->where('systemconfig_name', '质检会话响应时长设置')->find();
|
|
|
|
|
+ for ($c = 0; $c < count($alarm); $c++) {
|
|
|
$alarm[$c]['alarminfo'] = '';
|
|
$alarm[$c]['alarminfo'] = '';
|
|
|
- if($alarm[$c]['alarm_userSensitive'] != 0){
|
|
|
|
|
|
|
+ if ($alarm[$c]['alarm_userSensitive'] != 0) {
|
|
|
$alarm[$c]['alarminfo'] .= '访客敏感词/';
|
|
$alarm[$c]['alarminfo'] .= '访客敏感词/';
|
|
|
}
|
|
}
|
|
|
- if($alarm[$c]['alarm_serverSensitive'] != 0){
|
|
|
|
|
|
|
+ if ($alarm[$c]['alarm_serverSensitive'] != 0) {
|
|
|
$alarm[$c]['alarminfo'] .= '客服敏感词/';
|
|
$alarm[$c]['alarminfo'] .= '客服敏感词/';
|
|
|
}
|
|
}
|
|
|
- if($alarm[$c]['alarm_corresponding'] > $verifyReturnTime['systemconfig_data']){
|
|
|
|
|
|
|
+ if ($alarm[$c]['alarm_corresponding'] > $verifyReturnTime['systemconfig_data']) {
|
|
|
$alarm[$c]['alarminfo'] .= '响应超时/';
|
|
$alarm[$c]['alarminfo'] .= '响应超时/';
|
|
|
}
|
|
}
|
|
|
- if($alarm[$c]['alarm_cvtOvertime'] > $verifyAllTime['systemconfig_data']){
|
|
|
|
|
|
|
+ if ($alarm[$c]['alarm_cvtOvertime'] > $verifyAllTime['systemconfig_data']) {
|
|
|
$alarm[$c]['alarminfo'] .= '会话超时/';
|
|
$alarm[$c]['alarminfo'] .= '会话超时/';
|
|
|
}
|
|
}
|
|
|
- if($alarm[$c]['alarm_respond'] == 1){
|
|
|
|
|
|
|
+ if ($alarm[$c]['alarm_respond'] == 1) {
|
|
|
$alarm[$c]['alarminfo'] .= '客服未回应/';
|
|
$alarm[$c]['alarminfo'] .= '客服未回应/';
|
|
|
}
|
|
}
|
|
|
- if($alarm[$c]['alarm_count'] == 0){
|
|
|
|
|
|
|
+ if ($alarm[$c]['alarm_count'] == 0) {
|
|
|
$alarm[$c]['alarminfo'] .= '会话无内容';
|
|
$alarm[$c]['alarminfo'] .= '会话无内容';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- foreach($result as $key=>$vo){
|
|
|
|
|
- if($result[$key]['intime'] != 0){
|
|
|
|
|
|
|
+ foreach ($result as $key => $vo) {
|
|
|
|
|
+ if ($result[$key]['intime'] != 0) {
|
|
|
$result[$key]['intime'] = date('Y-m-d H:i:s', $vo['intime']);
|
|
$result[$key]['intime'] = date('Y-m-d H:i:s', $vo['intime']);
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
$result[$key]['intime'] = '-';
|
|
$result[$key]['intime'] = '-';
|
|
|
}
|
|
}
|
|
|
- if($result[$key]['start_time'] != 0){
|
|
|
|
|
|
|
+ if ($result[$key]['start_time'] != 0) {
|
|
|
$result[$key]['start_time'] = date('Y-m-d H:i:s', $vo['start_time']);
|
|
$result[$key]['start_time'] = date('Y-m-d H:i:s', $vo['start_time']);
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
$result[$key]['start_time'] = '-';
|
|
$result[$key]['start_time'] = '-';
|
|
|
}
|
|
}
|
|
|
- if($result[$key]['end_time'] != 0){
|
|
|
|
|
|
|
+ if ($result[$key]['end_time'] != 0) {
|
|
|
$result[$key]['end_time'] = date('Y-m-d H:i:s', $vo['end_time']);
|
|
$result[$key]['end_time'] = date('Y-m-d H:i:s', $vo['end_time']);
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
$result[$key]['end_time'] = '-';
|
|
$result[$key]['end_time'] = '-';
|
|
|
}
|
|
}
|
|
|
//客服昵称
|
|
//客服昵称
|
|
|
- for($i=0;$i<count($users);$i++){
|
|
|
|
|
|
|
+ for ($i = 0; $i < count($users); $i++) {
|
|
|
$result[$key]['kefu_name'] = '-';
|
|
$result[$key]['kefu_name'] = '-';
|
|
|
- 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'];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//满意度
|
|
//满意度
|
|
|
$result[$key]['evaluate_name'] = '';
|
|
$result[$key]['evaluate_name'] = '';
|
|
|
- for($j=0;$j<count($evaluate);$j++){
|
|
|
|
|
- if($result[$key]['evaluate_id'] == $evaluate[$j]['evaluate_id']){
|
|
|
|
|
|
|
+ for ($j = 0; $j < count($evaluate); $j++) {
|
|
|
|
|
+ if ($result[$key]['evaluate_id'] == $evaluate[$j]['evaluate_id']) {
|
|
|
$result[$key]['evaluate_name'] = $evaluate[$j]['evaluate_name'];
|
|
$result[$key]['evaluate_name'] = $evaluate[$j]['evaluate_name'];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//客服所在组
|
|
//客服所在组
|
|
|
- for($a=0;$a<count($groups);$a++){
|
|
|
|
|
- if($result[$key]['group_id'] == $groups[$a]['id']){
|
|
|
|
|
|
|
+ for ($a = 0; $a < count($groups); $a++) {
|
|
|
|
|
+ if ($result[$key]['group_id'] == $groups[$a]['id']) {
|
|
|
$result[$key]['group_name'] = $groups[$a]['name'];
|
|
$result[$key]['group_name'] = $groups[$a]['name'];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -749,63 +752,63 @@ class System extends Base
|
|
|
$result[$key]['conversation'] = '';
|
|
$result[$key]['conversation'] = '';
|
|
|
$result[$key]['response'] = '';
|
|
$result[$key]['response'] = '';
|
|
|
$result[$key]['alarm'] = '';
|
|
$result[$key]['alarm'] = '';
|
|
|
- for($b=0;$b<count($alarm);$b++){
|
|
|
|
|
- if($result[$key]['servicelog_id'] == $alarm[$b]['servicelog_id']){
|
|
|
|
|
|
|
+ for ($b = 0; $b < count($alarm); $b++) {
|
|
|
|
|
+ if ($result[$key]['servicelog_id'] == $alarm[$b]['servicelog_id']) {
|
|
|
//会话时长
|
|
//会话时长
|
|
|
- $conversation_min = intval($alarm[$b]['alarm_cvtOvertime']/60);
|
|
|
|
|
- $conversation_s = $alarm[$b]['alarm_cvtOvertime']%60;
|
|
|
|
|
- $result[$key]['conversation'] = $conversation_min.'分'.$conversation_s.'秒';
|
|
|
|
|
|
|
+ $conversation_min = intval($alarm[$b]['alarm_cvtOvertime'] / 60);
|
|
|
|
|
+ $conversation_s = $alarm[$b]['alarm_cvtOvertime'] % 60;
|
|
|
|
|
+ $result[$key]['conversation'] = $conversation_min . '分' . $conversation_s . '秒';
|
|
|
//响应时长
|
|
//响应时长
|
|
|
- $response_min = intval($alarm[$b]['alarm_corresponding']/60);
|
|
|
|
|
- $response_s = $alarm[$b]['alarm_corresponding']%60;
|
|
|
|
|
- $result[$key]['response'] = $response_min.'分'.$response_s.'秒';
|
|
|
|
|
|
|
+ $response_min = intval($alarm[$b]['alarm_corresponding'] / 60);
|
|
|
|
|
+ $response_s = $alarm[$b]['alarm_corresponding'] % 60;
|
|
|
|
|
+ $result[$key]['response'] = $response_min . '分' . $response_s . '秒';
|
|
|
//报警信息
|
|
//报警信息
|
|
|
$result[$key]['alarminfo'] = $alarm[$b]['alarminfo'];
|
|
$result[$key]['alarminfo'] = $alarm[$b]['alarminfo'];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if($vo['servicelog_close_type'] == 0){
|
|
|
|
|
|
|
+ if ($vo['servicelog_close_type'] == 0) {
|
|
|
$result[$key]['servicelog_close_type'] = '未知';
|
|
$result[$key]['servicelog_close_type'] = '未知';
|
|
|
}
|
|
}
|
|
|
- if($vo['servicelog_close_type'] == 1){
|
|
|
|
|
|
|
+ if ($vo['servicelog_close_type'] == 1) {
|
|
|
$result[$key]['servicelog_close_type'] = '无效会话';
|
|
$result[$key]['servicelog_close_type'] = '无效会话';
|
|
|
}
|
|
}
|
|
|
- if($vo['servicelog_close_type'] == 2){
|
|
|
|
|
|
|
+ if ($vo['servicelog_close_type'] == 2) {
|
|
|
$result[$key]['servicelog_close_type'] = '双方静默';
|
|
$result[$key]['servicelog_close_type'] = '双方静默';
|
|
|
}
|
|
}
|
|
|
- if($vo['servicelog_close_type'] == 3){
|
|
|
|
|
|
|
+ if ($vo['servicelog_close_type'] == 3) {
|
|
|
$result[$key]['servicelog_close_type'] = '客服关闭';
|
|
$result[$key]['servicelog_close_type'] = '客服关闭';
|
|
|
}
|
|
}
|
|
|
- if($vo['servicelog_close_type'] == 4){
|
|
|
|
|
|
|
+ if ($vo['servicelog_close_type'] == 4) {
|
|
|
$result[$key]['servicelog_close_type'] = '客服掉线';
|
|
$result[$key]['servicelog_close_type'] = '客服掉线';
|
|
|
}
|
|
}
|
|
|
- if($vo['servicelog_close_type'] == 5){
|
|
|
|
|
|
|
+ if ($vo['servicelog_close_type'] == 5) {
|
|
|
$result[$key]['servicelog_close_type'] = '转出';
|
|
$result[$key]['servicelog_close_type'] = '转出';
|
|
|
}
|
|
}
|
|
|
- if($vo['servicelog_close_type'] == 6){
|
|
|
|
|
|
|
+ if ($vo['servicelog_close_type'] == 6) {
|
|
|
$result[$key]['servicelog_close_type'] = '用户关闭';
|
|
$result[$key]['servicelog_close_type'] = '用户关闭';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//工单聊天详情
|
|
//工单聊天详情
|
|
|
- $chat_log = db('chat_log')->where('servicelog_id',$vo['servicelog_id'])->order('time_line', 'desc')->select();
|
|
|
|
|
|
|
+ $chat_log = db('chat_log')->where('servicelog_id', $vo['servicelog_id'])->order('time_line', 'desc')->select();
|
|
|
$result[$key]['detail'] = '';
|
|
$result[$key]['detail'] = '';
|
|
|
- for($c=0;$c<count($chat_log);$c++){
|
|
|
|
|
|
|
+ for ($c = 0; $c < count($chat_log); $c++) {
|
|
|
$content = json_decode($chat_log[$c]['content'], true);
|
|
$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'];
|
|
|
|
|
|
|
+ $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'] = '';
|
|
$content['content'] = '';
|
|
|
- if(!empty($content['text'])){
|
|
|
|
|
|
|
+ if (!empty($content['text'])) {
|
|
|
$content['content'] = $content['text'];
|
|
$content['content'] = $content['text'];
|
|
|
}
|
|
}
|
|
|
- if(!empty($content['img'])){
|
|
|
|
|
- $content['content'] = '<img width="100%" src="'.$content['img'].'"/>';
|
|
|
|
|
|
|
+ if (!empty($content['img'])) {
|
|
|
|
|
+ $content['content'] = '<img width="100%" src="' . $content['img'] . '"/>';
|
|
|
}
|
|
}
|
|
|
- $result[$key]['detail'] = $result[$key]['detail'].' '.$content['content'];
|
|
|
|
|
|
|
+ $result[$key]['detail'] = $result[$key]['detail'] . ' ' . $content['content'];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
- $head = ['工单id', '访客进线时间', '接待客服', '所在组', '访客账号', '开始时间', '结束时间', '会话时长', '响应时长', '关闭原因', '满意度','来源ip','来源网站','来源系统','来源浏览器','报警信息','聊天详情'];
|
|
|
|
|
- $key = ['servicelog_id', 'intime', 'kefu_name', 'group_name', 'user_name', 'start_time', 'end_time', 'conversation', 'response', 'servicelog_close_type', 'evaluate_name','user_ip','website','system','browse','alarminfo','detail'];
|
|
|
|
|
|
|
+ $head = ['工单id', '访客进线时间', '接待客服', '所在组', '访客账号', '开始时间', '结束时间', '会话时长', '响应时长', '关闭原因', '满意度', '来源ip', '来源网站', '来源系统', '来源浏览器', '报警信息', '聊天详情'];
|
|
|
|
|
+ $key = ['servicelog_id', 'intime', 'kefu_name', 'group_name', 'user_name', 'start_time', 'end_time', 'conversation', 'response', 'servicelog_close_type', 'evaluate_name', 'user_ip', 'website', 'system', 'browse', 'alarminfo', 'detail'];
|
|
|
(new Office())->outdata('工单数据导出', $result, $head, $key);
|
|
(new Office())->outdata('工单数据导出', $result, $head, $key);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
@@ -830,16 +833,19 @@ class System extends Base
|
|
|
public function platform()
|
|
public function platform()
|
|
|
{
|
|
{
|
|
|
// 表单提交.
|
|
// 表单提交.
|
|
|
|
|
+ $Where['platform_code'] = 'CustomerService';
|
|
|
|
|
+
|
|
|
if (request()->isPost()) {
|
|
if (request()->isPost()) {
|
|
|
$param = input('post.');
|
|
$param = input('post.');
|
|
|
|
|
+ $status = intval($param['status']) ? 1 : 0;
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- $updateWhere['platform_code'] = 'Customer-Service';
|
|
|
|
|
$updateData = [
|
|
$updateData = [
|
|
|
'platform_url_token' => $param['urlToken'],
|
|
'platform_url_token' => $param['urlToken'],
|
|
|
- 'platform_url_code' => $param['urlToken'],
|
|
|
|
|
|
|
+ 'platform_url_code' => $param['urlCode'],
|
|
|
|
|
+ 'platform_status' => $status,
|
|
|
];
|
|
];
|
|
|
- db('platform')->where($updateWhere)->update($updateData);
|
|
|
|
|
|
|
+ db('platform')->where($Where)->update($updateData);
|
|
|
return json(['code' => 1, 'data' => '', 'msg' => '设置成功']);
|
|
return json(['code' => 1, 'data' => '', 'msg' => '设置成功']);
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
return json(['code' => -2, 'data' => '', 'msg' => $e->getMessage()]);
|
|
return json(['code' => -2, 'data' => '', 'msg' => $e->getMessage()]);
|
|
@@ -847,11 +853,12 @@ class System extends Base
|
|
|
}//end if
|
|
}//end if
|
|
|
|
|
|
|
|
// 信息.
|
|
// 信息.
|
|
|
- $settings = db('platform')->find();
|
|
|
|
|
|
|
+ $settings = db('platform')->where($Where)->find();
|
|
|
$this->assign(
|
|
$this->assign(
|
|
|
[
|
|
[
|
|
|
'urlToken' => $settings['platform_url_token'],
|
|
'urlToken' => $settings['platform_url_token'],
|
|
|
'urlCode' => $settings['platform_url_code'],
|
|
'urlCode' => $settings['platform_url_code'],
|
|
|
|
|
+ 'status' => $settings['platform_status'],
|
|
|
]
|
|
]
|
|
|
);
|
|
);
|
|
|
|
|
|