|
|
@@ -136,6 +136,10 @@ class Events
|
|
|
}
|
|
|
|
|
|
$message = json_decode($message, true);
|
|
|
+ // 验证客服是否被删除或禁用.
|
|
|
+ if (isset($message['data']['conversationId'])) {
|
|
|
+ self::prohibitServer($message['data']['conversationId']);
|
|
|
+ }
|
|
|
if (isset($message['type'])) {
|
|
|
switch ($message['type']) {
|
|
|
case 'mydebug':
|
|
|
@@ -218,6 +222,23 @@ class Events
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ //更新用户缓存信息
|
|
|
+ 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)
|
|
|
{
|