|
|
@@ -123,10 +123,6 @@ class Events
|
|
|
*/
|
|
|
public static function onMessage($client_id, $message)
|
|
|
{
|
|
|
- if ($message!='{"type":"ping"}'){
|
|
|
- echo "onMessage: ".$message."\r\n";
|
|
|
- // print_r([self::$global->kfList,self::$global->userList, self::$global->uidSimpleList]);
|
|
|
- }
|
|
|
|
|
|
$message = json_decode($message, true);
|
|
|
switch ($message['type']) {
|
|
|
@@ -213,7 +209,6 @@ class Events
|
|
|
break;
|
|
|
// 聊天
|
|
|
case 'chatMessage':
|
|
|
-
|
|
|
$client = Gateway::getClientIdByUid($message['data']['to_id']);
|
|
|
if(!empty($client)){
|
|
|
$chat_message = [
|
|
|
@@ -237,6 +232,7 @@ class Events
|
|
|
'to_id' => $message['data']['to_id'],
|
|
|
'to_name' => $message['data']['to_name'],
|
|
|
'content' => $message['data']['content'],
|
|
|
+ 'servicelog_id' => $message['data']['conversationId'],
|
|
|
'time_line' => time()
|
|
|
];
|
|
|
|
|
|
@@ -651,26 +647,6 @@ class Events
|
|
|
$res['data']['0']
|
|
|
];
|
|
|
self::$global->userToKf = $userToKf;
|
|
|
- // 通知会员发送信息绑定客服的id
|
|
|
- $noticeUser = [
|
|
|
- 'message_type' => 'connect',
|
|
|
- 'data' => [
|
|
|
- 'kf_id' => $res['data']['0'],
|
|
|
- 'kf_name' => $res['data']['1']
|
|
|
- ]
|
|
|
- ];
|
|
|
- Gateway::sendToClient($client_id, json_encode($noticeUser));
|
|
|
- unset($noticeUser);
|
|
|
-
|
|
|
- // 通知客服端绑定会员的信息
|
|
|
- $noticeKf = [
|
|
|
- 'message_type' => 'connect',
|
|
|
- 'data' => [
|
|
|
- 'user_info' => $res['data']['3']
|
|
|
- ]
|
|
|
- ];
|
|
|
- Gateway::sendToClient($res['data']['2'], json_encode($noticeKf));
|
|
|
- unset($noticeKf);
|
|
|
|
|
|
// 服务信息入库
|
|
|
$serviceLog = [
|
|
|
@@ -689,9 +665,33 @@ class Events
|
|
|
'end_time' => 0
|
|
|
];
|
|
|
|
|
|
- self::$db->insert('ws_service_log')->cols($serviceLog)->query();
|
|
|
+ $conversationId = self::$db->insert('ws_service_log')->cols($serviceLog)->query();
|
|
|
unset($serviceLog);
|
|
|
|
|
|
+
|
|
|
+ // 通知会员发送信息绑定客服的id
|
|
|
+ $noticeUser = [
|
|
|
+ 'message_type' => 'connect',
|
|
|
+ 'data' => [
|
|
|
+ 'kf_id' => $res['data']['0'],
|
|
|
+ 'conversationId' => $conversationId,
|
|
|
+ 'kf_name' => $res['data']['1']
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ Gateway::sendToClient($client_id, json_encode($noticeUser));
|
|
|
+ unset($noticeUser);
|
|
|
+
|
|
|
+ // 通知客服端绑定会员的信息
|
|
|
+ $noticeKf = [
|
|
|
+ 'message_type' => 'connect',
|
|
|
+ 'data' => [
|
|
|
+ 'user_info' => $res['data']['3'],
|
|
|
+ 'conversationId' => $conversationId,
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ Gateway::sendToClient($res['data']['2'], json_encode($noticeKf));
|
|
|
+ unset($noticeKf);
|
|
|
+
|
|
|
// 写入接入值
|
|
|
$key = date('Ymd') . 'success_in';
|
|
|
self::$global->$key = 0;
|