|
@@ -106,7 +106,9 @@ class Socket extends Command
|
|
|
$op = isset($data['op']) ? $data['op'] : '';
|
|
$op = isset($data['op']) ? $data['op'] : '';
|
|
|
$userId = isset($data['from_uid'])? intval($data['from_uid']) : 0;
|
|
$userId = isset($data['from_uid'])? intval($data['from_uid']) : 0;
|
|
|
$chatKey = isset($data['chat_key'])? trim($data['chat_key']) : '';
|
|
$chatKey = isset($data['chat_key'])? trim($data['chat_key']) : '';
|
|
|
|
|
+ $toUid = isset($data['to_uid'])? intval($data['to_uid']) : 0;
|
|
|
if($userId && $frame->fd){
|
|
if($userId && $frame->fd){
|
|
|
|
|
+ $chatKey = $chatKey? $chatKey : getChatKey($userId, $toUid);
|
|
|
RedisService::set("chats:bind:{$userId}", ['fd'=> $frame->fd, 'user_id'=> $userId,'chat_key'=>$chatKey], 86400);
|
|
RedisService::set("chats:bind:{$userId}", ['fd'=> $frame->fd, 'user_id'=> $userId,'chat_key'=>$chatKey], 86400);
|
|
|
}
|
|
}
|
|
|
if ($data) {
|
|
if ($data) {
|
|
@@ -115,7 +117,6 @@ class Socket extends Command
|
|
|
$toUid = isset($data['to_uid']) ? intval($data['to_uid']) : 0;
|
|
$toUid = isset($data['to_uid']) ? intval($data['to_uid']) : 0;
|
|
|
$fromUid = isset($data['from_uid']) ? intval($data['from_uid']) : 0;
|
|
$fromUid = isset($data['from_uid']) ? intval($data['from_uid']) : 0;
|
|
|
$messageType = isset($data['message_type']) ? $data['message_type'] : 1;
|
|
$messageType = isset($data['message_type']) ? $data['message_type'] : 1;
|
|
|
-
|
|
|
|
|
if ($toUid <= 0 || $fromUid <= 0) {
|
|
if ($toUid <= 0 || $fromUid <= 0) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -127,6 +128,7 @@ class Socket extends Command
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$toInfo = MemberService::make()->getInfo($toUid);
|
|
$toInfo = MemberService::make()->getInfo($toUid);
|
|
|
|
|
+ var_dump($toInfo);
|
|
|
$fromInfo = MemberService::make()->getInfo($fromUid);
|
|
$fromInfo = MemberService::make()->getInfo($fromUid);
|
|
|
$message = isset($data['message']) ? $data['message'] : '';
|
|
$message = isset($data['message']) ? $data['message'] : '';
|
|
|
$chatKey = getChatKey($fromUid, $toUid);
|
|
$chatKey = getChatKey($fromUid, $toUid);
|
|
@@ -134,14 +136,16 @@ class Socket extends Command
|
|
|
'type' => isset($data['type']) ? $data['type'] : 1,
|
|
'type' => isset($data['type']) ? $data['type'] : 1,
|
|
|
'message_type' => $messageType,
|
|
'message_type' => $messageType,
|
|
|
'from_uid' => $fromUid,
|
|
'from_uid' => $fromUid,
|
|
|
- 'from_userName' => isset($fromInfo['username']) ? format_account($fromInfo['username']) : '客服',
|
|
|
|
|
|
|
+ 'from_username' => isset($fromInfo['username']) ? $fromInfo['username'] : '客服',
|
|
|
|
|
+ 'from_username_text' => isset($fromInfo['username']) ? format_account($fromInfo['username']) : '客服',
|
|
|
'to_uid' => isset($data['to_uid']) ? $data['to_uid'] : 0,
|
|
'to_uid' => isset($data['to_uid']) ? $data['to_uid'] : 0,
|
|
|
- 'to_userName' => isset($toInfo['username']) ? format_account($toInfo['username']) : '客服',
|
|
|
|
|
|
|
+ 'to_username' => isset($toInfo['username']) ? $toInfo['username'] : '客服',
|
|
|
|
|
+ 'to_username_text' => isset($toInfo['username']) ? format_account($toInfo['username']) : '客服',
|
|
|
'chat_key' => $chatKey,
|
|
'chat_key' => $chatKey,
|
|
|
'message' => $message,
|
|
'message' => $message,
|
|
|
'message_url' => $messageType == 2 && $message ? get_image_url($message) : '',
|
|
'message_url' => $messageType == 2 && $message ? get_image_url($message) : '',
|
|
|
'create_time' => time(),
|
|
'create_time' => time(),
|
|
|
- 'time_text' => date('m-d H:i'),
|
|
|
|
|
|
|
+ 'time_text' => format_time(time()-1),
|
|
|
'is_read' => 1,
|
|
'is_read' => 1,
|
|
|
'status' => 1,
|
|
'status' => 1,
|
|
|
];
|
|
];
|