perf: 优化预览消息
This commit is contained in:
@@ -185,7 +185,7 @@ class WebSocketDialog extends AbstractModel
|
||||
* @param $data
|
||||
* @param int $userid 会员ID
|
||||
* @param bool $hasData 已存在的消息类型
|
||||
* @return array|mixed
|
||||
* @return array
|
||||
*/
|
||||
public static function synthesizeData($data, $userid, $hasData = false)
|
||||
{
|
||||
@@ -250,6 +250,16 @@ class WebSocketDialog extends AbstractModel
|
||||
$data['last_msg'] = $data['last_msg'] ?? WebSocketDialogMsg::whereDialogId($data['id'])->orderByDesc('id')->first()?->toArray();
|
||||
}
|
||||
|
||||
// 最后消息处理
|
||||
if ($data['last_msg']) {
|
||||
foreach ($data['last_msg']['emoji'] as &$value) {
|
||||
unset($value['userids']);
|
||||
}
|
||||
if ($data['last_msg']['type'] === 'text') {
|
||||
$data['last_msg']['msg']['text'] = WebSocketDialogMsg::previewTextMsg($data['last_msg']['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
// 对方信息
|
||||
$data['pinyin'] = Base::cn2pinyin($data['name']);
|
||||
$data['quick_msgs'] = [];
|
||||
|
||||
Reference in New Issue
Block a user