|
|
@@ -1,4 +1,5 @@
|
|
|
<?php
|
|
|
+
|
|
|
/**
|
|
|
* This file is part of workerman.
|
|
|
*
|
|
|
@@ -138,59 +139,59 @@ class Events
|
|
|
|
|
|
$message = json_decode($message, true);
|
|
|
// 验证客服是否被删除或禁用.
|
|
|
-// if (isset($message['data']['conversationId'])) {
|
|
|
-// self::prohibitServer($message['data']['conversationId']);
|
|
|
-// }
|
|
|
+ // if (isset($message['data']['conversationId'])) {
|
|
|
+ // self::prohibitServer($message['data']['conversationId']);
|
|
|
+ // }
|
|
|
if (isset($message['type'])) {
|
|
|
switch ($message['type']) {
|
|
|
case 'mydebug':
|
|
|
self::mydebug($client_id, $message['data']);
|
|
|
break;
|
|
|
- // 管理员初始化
|
|
|
+ // 管理员初始化
|
|
|
case 'adminInit':
|
|
|
$token = $message['token'];
|
|
|
self::adminInit($client_id, $token);
|
|
|
break;
|
|
|
- //客服主动关闭
|
|
|
+ //客服主动关闭
|
|
|
case 'kfzdclose':
|
|
|
self::kfzdclose($client_id, $message['data']);
|
|
|
break;
|
|
|
- // 客服初始化
|
|
|
+ // 客服初始化
|
|
|
case 'init':
|
|
|
$data = $message['data'];
|
|
|
self::Kfinit($client_id, $data);
|
|
|
break;
|
|
|
- // 顾客初始化
|
|
|
+ // 顾客初始化
|
|
|
case 'userInit';
|
|
|
$data = $message['data'];
|
|
|
self::userInitEnt($client_id, $data);
|
|
|
break;
|
|
|
- //在线客服信息
|
|
|
+ //在线客服信息
|
|
|
case 'getkfonlines':
|
|
|
Gateway::sendToCurrentClient(json_encode(self::getkfonlines(), 256));
|
|
|
break;
|
|
|
- //客服获取用户详细信息
|
|
|
+ //客服获取用户详细信息
|
|
|
case 'kfgetuserinfo':
|
|
|
$tmp_id = isset($message['data']['id']) ? $message['data']['id'] : 0;
|
|
|
self::kfgetuserinfo($client_id, intval($tmp_id));
|
|
|
break;
|
|
|
- // 客服聊天
|
|
|
+ // 客服聊天
|
|
|
case 'chatMessage':
|
|
|
self::chatMessage($message['data']);
|
|
|
break;
|
|
|
- // 机器人问答.
|
|
|
+ // 机器人问答.
|
|
|
case 'toRobot':
|
|
|
self::toRobot($client_id, $message);
|
|
|
break;
|
|
|
- // 评价.
|
|
|
+ // 评价.
|
|
|
case 'evaluate':
|
|
|
self::evaluate($message['data']);
|
|
|
break;
|
|
|
- // 客服关闭会话.
|
|
|
+ // 客服关闭会话.
|
|
|
case 'kfCloseUser':
|
|
|
self::serverClose($message['data']['conversationId'], $message['data']['type']);
|
|
|
break;
|
|
|
- // 客服更改状态.
|
|
|
+ // 客服更改状态.
|
|
|
case 'kfOnline':
|
|
|
self::KFStatusCg($client_id, $message);
|
|
|
break;
|
|
|
@@ -200,7 +201,7 @@ class Events
|
|
|
case 'userlabeall':
|
|
|
self::getUserLabAll($client_id, $message);
|
|
|
break;
|
|
|
- // 弹出评价.
|
|
|
+ // 弹出评价.
|
|
|
case 'getEvaluate';
|
|
|
self::getEvaluate($message['data']);
|
|
|
break;
|
|
|
@@ -217,7 +218,7 @@ class Events
|
|
|
case 'updateusercache':
|
|
|
//更新用户缓存信息
|
|
|
self::updateusercache($client_id, $message['data']);
|
|
|
- // 客服更改状态.
|
|
|
+ // 客服更改状态.
|
|
|
case 'joinServiceGroup':
|
|
|
//后台更改了数据,sock里的缓存强制更新一下,做到即时更新的效果
|
|
|
self::joinServiceGroup($client_id, $message['data']);
|
|
|
@@ -257,7 +258,7 @@ class Events
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-//客服获取自己的用户列表
|
|
|
+ //客服获取自己的用户列表
|
|
|
public static function kfusersmaps($kfuid, $clientid)
|
|
|
{
|
|
|
$kfuid = self::getkfuid($kfuid);
|
|
|
@@ -282,7 +283,7 @@ class Events
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-//客服信息更新
|
|
|
+ //客服信息更新
|
|
|
public static function kfupdateinfo($client_id, $message)
|
|
|
{
|
|
|
$kfid = intval(self::getkfid($message['kfuid']));
|
|
|
@@ -307,10 +308,9 @@ class Events
|
|
|
$redisuser['job_name'] = $user['user_job_number'];
|
|
|
self::$redis->hset(self::KFINFOKEY, $kfuid, json_encode($redisuser, 256));
|
|
|
return;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-//将某个客服踢下线 (只能是管理员连上来的socket才可以操作)
|
|
|
+ //将某个客服踢下线 (只能是管理员连上来的socket才可以操作)
|
|
|
public static function tickkf($client_id, $messag)
|
|
|
{
|
|
|
|
|
|
@@ -332,37 +332,37 @@ class Events
|
|
|
}
|
|
|
|
|
|
|
|
|
-//看一个连接是否来自管理员的
|
|
|
+ //看一个连接是否来自管理员的
|
|
|
public static function isAdmin($client_id)
|
|
|
{
|
|
|
return self::$redis->sismember(self::ADMINLIST, $client_id);
|
|
|
}
|
|
|
|
|
|
-//更新用户缓存信息
|
|
|
-// public static function prohibitServer($serviceLogId)
|
|
|
-// {
|
|
|
-// $data = json_decode(self::$redis->HGET('SERVICELOG', $serviceLogId), true);
|
|
|
-// $userInfo = self::$db->select('status')->from('ws_users')->where('id=:id')->bindValues(['id' => $data['kf_id']])->row();
|
|
|
-// if (!$userInfo || $userInfo['status'] != 1) {
|
|
|
-// $chat_message = [
|
|
|
-// 'message_type' => 'error',
|
|
|
-// 'data' => [
|
|
|
-// 'msg' => '账号异常!'
|
|
|
-// ]
|
|
|
-// ];
|
|
|
-// Gateway::sendToClient($data['kf_client_id'], json_encode($chat_message, 256));
|
|
|
-// Gateway::closeClient($data['kf_client_id']);
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-//更新用户缓存信息
|
|
|
+ //更新用户缓存信息
|
|
|
+ // public static function prohibitServer($serviceLogId)
|
|
|
+ // {
|
|
|
+ // $data = json_decode(self::$redis->HGET('SERVICELOG', $serviceLogId), true);
|
|
|
+ // $userInfo = self::$db->select('status')->from('ws_users')->where('id=:id')->bindValues(['id' => $data['kf_id']])->row();
|
|
|
+ // if (!$userInfo || $userInfo['status'] != 1) {
|
|
|
+ // $chat_message = [
|
|
|
+ // 'message_type' => 'error',
|
|
|
+ // 'data' => [
|
|
|
+ // 'msg' => '账号异常!'
|
|
|
+ // ]
|
|
|
+ // ];
|
|
|
+ // Gateway::sendToClient($data['kf_client_id'], json_encode($chat_message, 256));
|
|
|
+ // Gateway::closeClient($data['kf_client_id']);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ //更新用户缓存信息
|
|
|
public static function updateusercache($client_id, $dataArray)
|
|
|
{
|
|
|
$uid = intval($dataArray['userid']);
|
|
|
self::getUserInfoCache($uid, 180, 0);
|
|
|
}
|
|
|
|
|
|
-//加入工单群组(未完)
|
|
|
+ //加入工单群组(未完)
|
|
|
public static function joinServiceGroup($client_id, $message)
|
|
|
{
|
|
|
$uid = $message['uid'];
|
|
|
@@ -382,13 +382,13 @@ class Events
|
|
|
Gateway::joinGroup($client_id, $serviceLogId);
|
|
|
}
|
|
|
|
|
|
-//强制更新缓存信息
|
|
|
+ //强制更新缓存信息
|
|
|
public static function updatecache($client_id, $dataArray)
|
|
|
{
|
|
|
self::upsystemconfig();
|
|
|
}
|
|
|
|
|
|
-//用户取消排队
|
|
|
+ //用户取消排队
|
|
|
public static function cancelqueue($messageArray)
|
|
|
{
|
|
|
$uid = intval($messageArray['uid']);
|
|
|
@@ -411,7 +411,7 @@ class Events
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-// 弹出评价.
|
|
|
+ // 弹出评价.
|
|
|
public static function getEvaluate($message)
|
|
|
{
|
|
|
// 获取当前会话工单.
|
|
|
@@ -428,7 +428,7 @@ class Events
|
|
|
Gateway::sendToClient($data['client_id'], json_encode($chat_message, 256));
|
|
|
}
|
|
|
|
|
|
-//客服聊天
|
|
|
+ //客服聊天
|
|
|
public static function chatMessage($message)
|
|
|
{
|
|
|
// 获取当前会话工单.
|
|
|
@@ -495,7 +495,7 @@ class Events
|
|
|
self::$db->insert('ws_chat_log')->cols($insertChatData)->query();
|
|
|
}
|
|
|
|
|
|
-//得到一个用户详细信息
|
|
|
+ //得到一个用户详细信息
|
|
|
public
|
|
|
static function kfgetuserinfo($clientid, $id)
|
|
|
{
|
|
|
@@ -504,7 +504,7 @@ class Events
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-//获取在线客服列表
|
|
|
+ //获取在线客服列表
|
|
|
public
|
|
|
static function getkfonlines()
|
|
|
{
|
|
|
@@ -573,7 +573,7 @@ class Events
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-//获取某个用户全部信息
|
|
|
+ //获取某个用户全部信息
|
|
|
public
|
|
|
static function getClientIndo($id)
|
|
|
{
|
|
|
@@ -581,7 +581,7 @@ class Events
|
|
|
return $ret;
|
|
|
}
|
|
|
|
|
|
-//客服接入sock,及初始化
|
|
|
+ //客服接入sock,及初始化
|
|
|
public
|
|
|
static function Kfinit($client_id, $message)
|
|
|
{
|
|
|
@@ -688,7 +688,7 @@ class Events
|
|
|
}
|
|
|
|
|
|
|
|
|
-//连接信息里保存用户,以便观察
|
|
|
+ //连接信息里保存用户,以便观察
|
|
|
private
|
|
|
static function updateWebsockName($client_id, $uid)
|
|
|
{
|
|
|
@@ -700,7 +700,7 @@ class Events
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-//客服掉线后 历史聊天记录
|
|
|
+ //客服掉线后 历史聊天记录
|
|
|
private
|
|
|
static function SendKFHistoryRecord($client_id, $userId)
|
|
|
{
|
|
|
@@ -712,7 +712,7 @@ class Events
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-//客服上线重新处理下旧的没完成的工单信息
|
|
|
+ //客服上线重新处理下旧的没完成的工单信息
|
|
|
private
|
|
|
static function kfonlilneRework($clientid, $kfuid)
|
|
|
{
|
|
|
@@ -755,7 +755,7 @@ class Events
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//客服登陆验证
|
|
|
+ //客服登陆验证
|
|
|
public static function KfloginCheck($client, $messageArray)
|
|
|
{
|
|
|
$uid = isset($messageArray['uid']) ? $messageArray['uid'] : '';
|
|
|
@@ -800,7 +800,7 @@ class Events
|
|
|
return $defret;
|
|
|
}
|
|
|
|
|
|
-//用户发送邦定用户事件
|
|
|
+ //用户发送邦定用户事件
|
|
|
public
|
|
|
static function userInitEnt($client_id, $message)
|
|
|
{
|
|
|
@@ -868,10 +868,10 @@ class Events
|
|
|
'id' => $uid,
|
|
|
'name' => $message['name'],
|
|
|
'avatar' => isset($message['avatar']) ? $message['avatar'] : '',
|
|
|
- 'website' => $_SESSION['origin'],//$message['website'],
|
|
|
+ 'website' => $_SESSION['origin'], //$message['website'],
|
|
|
'browse' => Gateway::browse_info(),
|
|
|
- 'system' => $system,//$message['system'],
|
|
|
- 'ip' => isset($_SESSION['remotip']) ? $_SESSION['remotip'] : '',//message['ip'],
|
|
|
+ 'system' => $system, //$message['system'],
|
|
|
+ 'ip' => isset($_SESSION['remotip']) ? $_SESSION['remotip'] : '', //message['ip'],
|
|
|
'ipinfo' => self::getUserIPinfo($_SESSION['remotip']),
|
|
|
'group' => $message['group'],
|
|
|
'intime' => time(),
|
|
|
@@ -939,7 +939,7 @@ class Events
|
|
|
}
|
|
|
|
|
|
|
|
|
-//客服掉线处理 第二版 系统调用,不能手动调用
|
|
|
+ //客服掉线处理 第二版 系统调用,不能手动调用
|
|
|
public
|
|
|
static function serviceOfflineV2($client_id, $uid)
|
|
|
{
|
|
|
@@ -970,7 +970,7 @@ class Events
|
|
|
}
|
|
|
|
|
|
|
|
|
-//客服下线了 系统调用,不能手动调用
|
|
|
+ //客服下线了 系统调用,不能手动调用
|
|
|
public
|
|
|
static function serviceOffline($client_id, $uid)
|
|
|
{
|
|
|
@@ -1010,7 +1010,7 @@ class Events
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-//用户下线了 系统调用,不能手动调用
|
|
|
+ //用户下线了 系统调用,不能手动调用
|
|
|
public
|
|
|
static function guestOffline($client_id, $uid)
|
|
|
{
|
|
|
@@ -1070,9 +1070,7 @@ class Events
|
|
|
*/
|
|
|
public
|
|
|
static function closeUser($servicelog_id, $userId, $kf_id, $groupId)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
+ { }
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -1194,9 +1192,7 @@ class Events
|
|
|
*/
|
|
|
private
|
|
|
static function userOfflineTask($group)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
+ { }
|
|
|
|
|
|
/**
|
|
|
* 有人进入执行分配
|
|
|
@@ -1290,7 +1286,7 @@ class Events
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-//踢掉某个组没有客服的用户
|
|
|
+ //踢掉某个组没有客服的用户
|
|
|
private
|
|
|
static function Kf_user_click($kfArrays, $userLIsts)
|
|
|
{
|
|
|
@@ -1306,7 +1302,7 @@ class Events
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-//开启一个会话
|
|
|
+ //开启一个会话
|
|
|
private
|
|
|
static function BeginTalk($kfuid, $uid, $group, $serviceid = 0, $userInfo = false, $isChangeKF = 0, $oldChatLog = [])
|
|
|
{
|
|
|
@@ -1392,7 +1388,8 @@ class Events
|
|
|
|
|
|
$userInfo['intime'] = date("H:i", $userInfo['intime']); ///后改为只显示小时分
|
|
|
$ut_tmp = self::getUserInfoCache($uid);
|
|
|
- $userInfo = array_merge($userInfo,
|
|
|
+ $userInfo = array_merge(
|
|
|
+ $userInfo,
|
|
|
[
|
|
|
'account_name' => $ut_tmp['account_name'],
|
|
|
'nick_name' => $ut_tmp['nick_name'],
|
|
|
@@ -1423,7 +1420,7 @@ class Events
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-//连接至上一个会话
|
|
|
+ //连接至上一个会话
|
|
|
private
|
|
|
static function BeginOldTalk($kfuid, $uid, $group, $serviceid = 0, $userInfo = false)
|
|
|
{
|
|
|
@@ -1484,7 +1481,8 @@ class Events
|
|
|
// 发送给客服用户信息.
|
|
|
$userInfo['intime'] = date("H:i", $userInfo['intime']);
|
|
|
$ut_tmp = self::getUserInfoCache($uid);
|
|
|
- $userInfo = array_merge($userInfo,
|
|
|
+ $userInfo = array_merge(
|
|
|
+ $userInfo,
|
|
|
[
|
|
|
'account_name' => $ut_tmp['account_name'],
|
|
|
'nick_name' => $ut_tmp['nick_name'],
|
|
|
@@ -1515,7 +1513,7 @@ class Events
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-//获取工单最后20条聊天记录
|
|
|
+ //获取工单最后20条聊天记录
|
|
|
private
|
|
|
static function getServerChagLog($sericeId, $limit = 20)
|
|
|
{
|
|
|
@@ -1530,7 +1528,7 @@ class Events
|
|
|
return [];
|
|
|
}
|
|
|
|
|
|
-//用户排队数据 按组
|
|
|
+ //用户排队数据 按组
|
|
|
private
|
|
|
static function getUserListData()
|
|
|
{
|
|
|
@@ -1562,7 +1560,7 @@ class Events
|
|
|
return $allusergkarr;
|
|
|
}
|
|
|
|
|
|
-//找到可以接工单的客服 按组
|
|
|
+ //找到可以接工单的客服 按组
|
|
|
private
|
|
|
static function getWorkKfData()
|
|
|
{
|
|
|
@@ -1601,7 +1599,7 @@ class Events
|
|
|
}
|
|
|
|
|
|
|
|
|
-//找到用户是否有一条未关闭的会话
|
|
|
+ //找到用户是否有一条未关闭的会话
|
|
|
private
|
|
|
static function UserHasOldTalk($uid, $database = 0)
|
|
|
{
|
|
|
@@ -1626,7 +1624,7 @@ class Events
|
|
|
}
|
|
|
|
|
|
|
|
|
-//今天排序累加
|
|
|
+ //今天排序累加
|
|
|
private
|
|
|
static function todayqueuelength()
|
|
|
{
|
|
|
@@ -1641,11 +1639,12 @@ class Events
|
|
|
'dtype' => $dtype,
|
|
|
'mdate' => $today,
|
|
|
'datatype' => 1,
|
|
|
- 'dcontent' => 1))->query();
|
|
|
+ 'dcontent' => 1
|
|
|
+ ))->query();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//客服工单转单
|
|
|
+ //客服工单转单
|
|
|
private
|
|
|
static function servicetrutoother($type, $owen, $otherkfid, $serverid, $clientuid)
|
|
|
{
|
|
|
@@ -1671,9 +1670,7 @@ class Events
|
|
|
*/
|
|
|
private
|
|
|
static function assignmentTask($kfList, $userList, $group, $total, $uid = 0)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
+ { }
|
|
|
|
|
|
/**
|
|
|
* 获取最大的服务人数
|
|
|
@@ -1795,7 +1792,7 @@ class Events
|
|
|
}
|
|
|
|
|
|
|
|
|
-//获取系统配置
|
|
|
+ //获取系统配置
|
|
|
private
|
|
|
static function upsystemconfig()
|
|
|
{
|
|
|
@@ -1997,7 +1994,7 @@ class Events
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//客户工单内部组转接
|
|
|
+ //客户工单内部组转接
|
|
|
public
|
|
|
static function changeOtherhKeFu($client_id, $smessage)
|
|
|
{
|
|
|
@@ -2049,7 +2046,7 @@ class Events
|
|
|
///更新redis数据
|
|
|
self::updteKfTasksByservicd($fromkfuid, $serviceid, $user_info['client_id'], 0);
|
|
|
|
|
|
- self:: BeginTalk($toukfid, $uid, $groupidto, 0, $user_info, 1, $oldChatLog);
|
|
|
+ self::BeginTalk($toukfid, $uid, $groupidto, 0, $user_info, 1, $oldChatLog);
|
|
|
self::servicetrutoother('OUT', $fromkfuid, $toukfid, $serviceid, $uid);
|
|
|
$newUserInfo = json_decode(self::$redis->hget(self::USERINFOKEY, $uid), true);
|
|
|
self::servicetrutoother('IN', $toukfid, $fromkfuid, $newUserInfo['serverid'], $uid);
|
|
|
@@ -2068,7 +2065,7 @@ class Events
|
|
|
}
|
|
|
|
|
|
|
|
|
-//客服在线状态写组
|
|
|
+ //客服在线状态写组
|
|
|
private static function writeLogKfStatus($kf, $status, $flag = 1)
|
|
|
{
|
|
|
if ($flag == 1) {
|
|
|
@@ -2110,7 +2107,6 @@ class Events
|
|
|
self::$redis->flushdb();
|
|
|
self::$db->query("update ws_service_log set status=2,end_time=$now where start_time>=$t and status!=2");
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public
|
|
|
@@ -2122,20 +2118,15 @@ class Events
|
|
|
}
|
|
|
|
|
|
|
|
|
-//用户下线通知
|
|
|
+ //用户下线通知
|
|
|
private
|
|
|
static function userCloseNotice($client_id, $cuid, $group)
|
|
|
- {
|
|
|
+ { }
|
|
|
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-//踢掉同一用户的旧用户
|
|
|
+ //踢掉同一用户的旧用户
|
|
|
private
|
|
|
static function tickOlduser($uid)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
+ { }
|
|
|
|
|
|
private
|
|
|
static function DebugOut($msg, $title = '', $type = 'info')
|
|
|
@@ -2152,7 +2143,7 @@ class Events
|
|
|
}
|
|
|
|
|
|
|
|
|
-//定时器相关
|
|
|
+ //定时器相关
|
|
|
private
|
|
|
static function TimerThing($worker)
|
|
|
{
|
|
|
@@ -2254,7 +2245,6 @@ class Events
|
|
|
});
|
|
|
|
|
|
self::resetServiceLog();
|
|
|
-
|
|
|
} elseif (1 == $worker->id) {
|
|
|
|
|
|
// 1分钟统计一次实时数据
|
|
|
@@ -2265,7 +2255,6 @@ class Events
|
|
|
Timer::add(60 * 40, function () {
|
|
|
self::writeLog(2);
|
|
|
});
|
|
|
-
|
|
|
} elseif (2 == $worker->id) {
|
|
|
|
|
|
//初始化.....
|
|
|
@@ -2280,8 +2269,6 @@ class Events
|
|
|
$oldKey = date('Ymd', strtotime('-1 day'));
|
|
|
unset(self::$global->$oldKey);
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
} elseif (3 == $worker->id) {
|
|
|
// 管理员实时监控.
|
|
|
Timer::add(20, function () {
|
|
|
@@ -2298,15 +2285,12 @@ class Events
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-//调试使用
|
|
|
+ //调试使用
|
|
|
public
|
|
|
static function mydebug($client_id, $message)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
+ { }
|
|
|
|
|
|
public
|
|
|
static function MySendMsg($clientId, $msg)
|
|
|
@@ -2314,7 +2298,7 @@ class Events
|
|
|
Gateway::sendToClient($clientId, $msg);
|
|
|
}
|
|
|
|
|
|
-//得到客服的UID字符值
|
|
|
+ //得到客服的UID字符值
|
|
|
public
|
|
|
static function getkfuid($uid)
|
|
|
{
|
|
|
@@ -2325,7 +2309,7 @@ class Events
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//得到客服的ID整数值
|
|
|
+ //得到客服的ID整数值
|
|
|
public
|
|
|
static function getkfid($id)
|
|
|
{
|
|
|
@@ -2335,7 +2319,7 @@ class Events
|
|
|
return intval($id);
|
|
|
}
|
|
|
|
|
|
-//从数组中获取参数
|
|
|
+ //从数组中获取参数
|
|
|
public
|
|
|
static function getPars($array, $key, $default = '')
|
|
|
{
|
|
|
@@ -2345,7 +2329,7 @@ class Events
|
|
|
return $default;
|
|
|
}
|
|
|
|
|
|
-//获取在线客服信息
|
|
|
+ //获取在线客服信息
|
|
|
public
|
|
|
static function getOnlineKfData($group = 0, $status = 0)
|
|
|
{
|
|
|
@@ -2371,7 +2355,7 @@ class Events
|
|
|
return $return;
|
|
|
}
|
|
|
|
|
|
-//找到在排队的用户按时间先后顺序
|
|
|
+ //找到在排队的用户按时间先后顺序
|
|
|
public
|
|
|
static function getUselistData($group)
|
|
|
{
|
|
|
@@ -2395,7 +2379,7 @@ class Events
|
|
|
return $return;
|
|
|
}
|
|
|
|
|
|
-//对客服的用户user_info数组进行加减操作 $clientid用户连接号 opt=1添加 0删除 $serverid服务工单号
|
|
|
+ //对客服的用户user_info数组进行加减操作 $clientid用户连接号 opt=1添加 0删除 $serverid服务工单号
|
|
|
public
|
|
|
static function ArrayDataopt($array, $clientid, $opt, $serverid = 0)
|
|
|
{
|
|
|
@@ -2414,7 +2398,7 @@ class Events
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//用户重要性标签
|
|
|
+ //用户重要性标签
|
|
|
private
|
|
|
static function getUserLabAll($client_id, $message)
|
|
|
{
|
|
|
@@ -2422,16 +2406,13 @@ class Events
|
|
|
Gateway::sendToCurrentClient(json_encode(['message_type' => 'userlabeall', 'data' => $data], 256));
|
|
|
}
|
|
|
|
|
|
-//调试使用
|
|
|
+ //调试使用
|
|
|
public
|
|
|
static function debug($dataArray)
|
|
|
- {
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
+ { }
|
|
|
|
|
|
|
|
|
-//客服的工单hash健名
|
|
|
+ //客服的工单hash健名
|
|
|
public
|
|
|
static function getKfServiceKey($kfuid)
|
|
|
{
|
|
|
@@ -2439,7 +2420,7 @@ class Events
|
|
|
}
|
|
|
|
|
|
|
|
|
-//获取客服所有连接信息及工单信息
|
|
|
+ //获取客服所有连接信息及工单信息
|
|
|
public
|
|
|
static function getKfTasks($kfuid)
|
|
|
{
|
|
|
@@ -2450,7 +2431,7 @@ class Events
|
|
|
return $all;
|
|
|
}
|
|
|
|
|
|
-//设置或删除客服的连接 opt==0删除 1添加
|
|
|
+ //设置或删除客服的连接 opt==0删除 1添加
|
|
|
public
|
|
|
static function setKfTasks($kfuid, $clientid, $opt = 0, $serviceid = 0)
|
|
|
{
|
|
|
@@ -2462,7 +2443,7 @@ class Events
|
|
|
self::$redis->hset($k, $clientid, $serviceid);
|
|
|
}
|
|
|
|
|
|
-//有旧单时,更新连接ID
|
|
|
+ //有旧单时,更新连接ID
|
|
|
public
|
|
|
static function updteKfTasksByservicd($kfuid, $serciceid, $newclientid, $opt = 1)
|
|
|
{
|
|
|
@@ -2494,10 +2475,9 @@ class Events
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-//客服用户映射哈希表
|
|
|
+ //客服用户映射哈希表
|
|
|
public
|
|
|
static function addKfUsermap($kfuid, $userid = 0, $opt = 1)
|
|
|
{
|
|
|
@@ -2517,7 +2497,7 @@ class Events
|
|
|
return $ret;
|
|
|
}
|
|
|
|
|
|
-//缓存获取用户信息
|
|
|
+ //缓存获取用户信息
|
|
|
public
|
|
|
static function getUserInfoCache($uid, $cacheTime = 180, $fcache = 1)
|
|
|
{
|
|
|
@@ -2537,7 +2517,7 @@ class Events
|
|
|
return $date;
|
|
|
}
|
|
|
|
|
|
-//检查一个新人是否需要排队
|
|
|
+ //检查一个新人是否需要排队
|
|
|
public
|
|
|
static function HasInqueue($group)
|
|
|
{
|
|
|
@@ -2569,7 +2549,7 @@ class Events
|
|
|
}
|
|
|
|
|
|
|
|
|
-//公共请求接口
|
|
|
+ //公共请求接口
|
|
|
public
|
|
|
static function getApiData($url, $paras, $api_token, $user_token = '')
|
|
|
{
|
|
|
@@ -2590,7 +2570,7 @@ class Events
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//api token 生成
|
|
|
+ //api token 生成
|
|
|
public
|
|
|
static function apiTokenMake($action, $controller = 'ext', $module = 'service')
|
|
|
{
|
|
|
@@ -2611,19 +2591,17 @@ class Events
|
|
|
|
|
|
$postUrl = $url;
|
|
|
$curlPost = $param;
|
|
|
- $ch = curl_init();//初始化curl
|
|
|
- curl_setopt($ch, CURLOPT_URL, $postUrl);//抓取指定网页
|
|
|
- curl_setopt($ch, CURLOPT_HEADER, 0);//设置header
|
|
|
+ $ch = curl_init(); //初始化curl
|
|
|
+ curl_setopt($ch, CURLOPT_URL, $postUrl); //抓取指定网页
|
|
|
+ curl_setopt($ch, CURLOPT_HEADER, 0); //设置header
|
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
|
|
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
|
|
|
- curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
|
|
|
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //要求结果为字符串且输出到屏幕上
|
|
|
+ curl_setopt($ch, CURLOPT_POST, 1); //post提交方式
|
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
|
|
|
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
|
|
- $data = curl_exec($ch);//运行curl
|
|
|
+ $data = curl_exec($ch); //运行curl
|
|
|
curl_close($ch);
|
|
|
|
|
|
return $data;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|