|
|
@@ -356,12 +356,6 @@ class Events
|
|
|
self::writeLogKfStatus($userId, $status);
|
|
|
Gateway::sendToCurrentClient(json_encode(['message_type' => 'cgstatus', 'data' => ['new_status' => $status, 'old_status' => $oldstatus]]));
|
|
|
|
|
|
- $flag = self::$redis->hget(self::KFRELONINFLAG, $userId);
|
|
|
- if (!empty($flag)) {
|
|
|
- self::kfonlilneRework($client_id, $userId);
|
|
|
- self::$redis->hdel(self::KFRELONINFLAG, $userId);
|
|
|
- }
|
|
|
-
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -448,11 +442,25 @@ class Events
|
|
|
];
|
|
|
self::MySendMsg($client_id, json_encode($chat_message, 256));
|
|
|
unset($chat_message);
|
|
|
- self::writeLogKfStatus($message['uid'], 2);
|
|
|
+ self::KFStatusCg($client_id, ['data' => ['uid' => $uid, 'status' => 1]]);
|
|
|
+
|
|
|
+ self::SendKFHistoryRecord($client_id, $uid);
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ //客服掉线后 历史聊天记录
|
|
|
+ private static function SendKFHistoryRecord($client_id, $userId)
|
|
|
+ {
|
|
|
+ $flag = self::$redis->hget(self::KFRELONINFLAG, $userId);
|
|
|
+ if (!empty($flag)) {
|
|
|
+ self::kfonlilneRework($client_id, $userId);
|
|
|
+ self::$redis->hdel(self::KFRELONINFLAG, $userId);
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
//客服上线重新处理下旧的没完成的工单信息
|
|
|
private static function kfonlilneRework($clientid, $kfuid)
|
|
|
{
|
|
|
@@ -903,12 +911,15 @@ class Events
|
|
|
|
|
|
// 查询工单历史会话.
|
|
|
$serviceid = $last['servicelog_id'];
|
|
|
- $chatLog = self::$db->query("SELECT * FROM `ws_chat_log` where `servicelog_id`= '$serviceid' order by `time_line`");
|
|
|
+ //$chatLog = self::$db->query("SELECT * FROM `ws_chat_log` where `servicelog_id`= '$serviceid' order by `time_line`");
|
|
|
$toOld_message = [
|
|
|
'message_type' => 'toOld',
|
|
|
'data' => [
|
|
|
- 'chatLog' => $chatLog ?? [],
|
|
|
- 'content' => '接入至未结束的会话'
|
|
|
+ //'chatLog' => $chatLog ?? [],
|
|
|
+ 'chatLog' => [],
|
|
|
+ 'content' => '接入至未结束的会话',
|
|
|
+ 'serviceid' => $serviceid,
|
|
|
+ 'uid' => $uid
|
|
|
]
|
|
|
];
|
|
|
Gateway::sendToCurrentClient(json_encode($toOld_message, 256));
|
|
|
@@ -1077,6 +1088,7 @@ class Events
|
|
|
'data' => [
|
|
|
'user_info' => $userInfo,
|
|
|
'conversationId' => $serviceid,
|
|
|
+ 'history' => [],
|
|
|
]
|
|
|
];
|
|
|
self::MySendMsg($kfinfo['client_id'], json_encode($noticeKf, 256));
|