单聊消息
单发单聊消息
$tim->message->setTIMTextElem('你好')->sendMsg('101');
$tim->message->setTIMLocationElem('someinfo', 29.340656774469956, 116.77497920478824)->sendMsg('101');
$tim->message
->setTIMTextElem('在吗')
->setTIMLocationElem('someinfo', 29.340656774469956, 116.77497920478824)
->setTIMFaceElem(1, 'content')
->setTIMCustomElem('message', 'notification', 'url', 'dingdong.aiff')
->setTIMSoundElem('sound_url')
->setTIMImageElem('image_url')
->setTIMImageElem([
[
'type' => 1,
'size' => 1853095,
'width' => 2448,
'height' => 3264,
'url' => 'http://xxx/3200490432214177468_144115198371610486_D61040894AC3DE44CDFFFB3EC7EB720F/0',
],
[
'type' => 2,
'size' => 2565240,
'width' => 0,
'height' => 0,
'url' => 'http://xxx/3200490432214177468_144115198371610486_D61040894AC3DE44CDFFFB3EC7EB720F/720',
],
[
'type' => 3,
'size' => 12535,
'width' => 0,
'height' => 0,
'url' => 'http://xxx/3200490432214177468_144115198371610486_D61040894AC3DE44CDFFFB3EC7EB720F/198',
]
])
->setTIMFileElem('file_url')
->setTIMVideoFileElem('video_url', 'thumb_url')
->setTIMVideoFileElem([
'url' => 'https://0345-1400187352-1256635546.cos.ap-shanghai.myqcloud.com/abcd/f7c6ad3c50af7d83e23efe0a208b90c9',
'uuid' => '5da38ba89d6521011e1f6f3fd6692e35',
'size' => 1194603,
'second' => 5,
'format' => 'mp4',
], [
'url' => 'https://0345-1400187352-1256635546.cos.ap-shanghai.myqcloud.com/abcd/a6c170c9c599280cb06e0523d7a1f37b',
'uuid' => '6edaffedef5150684510cf97957b7bc8',
'size' => 13907,
'width' => 720,
'height' => 1280,
'format' => 'JPG',
])
->setCloudCustomData('云端保存消息')
->beforeCallback(false)
->afterCallback(false)
->noUnread(true)
->noLastMsg(true)
->withMuteNotifications(true)
->setOfflinePushInfo(new OfflinePushInfo(0, '这是推送标题', '这是离线推送内容', '这是透传的内容'))
->sendMsg(101, '102', false, 86400);
批量发单聊消息
$tim->message->setTIMTextElem('你好')->batchSendMsg(['101', '102']);
$tim->message->setTIMLocationElem('someinfo', 29.340656774469956, 116.77497920478824)->batchSendMsg(['101', '102']);
$tim->message
->setTIMTextElem('在吗')
->setTIMLocationElem('someinfo', 29.340656774469956, 116.77497920478824)
->setTIMFaceElem(1, 'content')
->setTIMCustomElem('message', 'notification', 'url', 'dingdong.aiff')
->setTIMSoundElem('sound_url')
->setTIMImageElem('image_url')
->setTIMFileElem('file_url')
->setTIMVideoFileElem('video_url', 'thumb_url')
->setCloudCustomData('云端保存消息')
->noUnread(true)
->noLastMsg(true)
->withMuteNotifications(true)
->setOfflinePushInfo(new OfflinePushInfo(0, '这是推送标题', '这是离线推送内容', '这是透传的内容'))
->batchSendMsg(['101', 103], '102', false, 86400);
导入单聊消息
$tim->message->setTIMTextElem('你好')->importMsg('101', '102');
$tim->message
->setTIMTextElem('在吗')
->setTIMLocationElem('someinfo', 29.340656774469956, 116.77497920478824)
->setTIMFaceElem(1, 'content')
->setTIMCustomElem('message', 'notification', 'url', 'dingdong.aiff')
->setTIMSoundElem('sound_url')
->setTIMImageElem('image_url')
->setTIMFileElem('file_url')
->setTIMVideoFileElem('video_url', 'thumb_url')
->setCloudCustomData('云端保存消息')
->noUnread(true)
->noLastMsg(true)
->withMuteNotifications(true)
->setOfflinePushInfo(new OfflinePushInfo(0, '这是推送标题', '这是离线推送内容', '这是透传的内容'))
->importMsg('101', 102, time(), false);
查询单聊消息
$tim->message->getRoamMsg('101', 102, 100, time() - 86400, time());
撤回单聊消息
$tim->message->msgWithdraw('101', 102, '31906_833502_1572869830');
设置单聊消息已读
$tim->message->setMsgRead('101', 102);
查询单聊未读消息计数
$tim->message->getUnreadMsgNum('101', [102, '103']);
$tim->message->getUnreadMsgNum('101', 102);
修改单聊历史消息
$tim->message
->setCloudCustomData('云端保存消息')
->modifyMsg('101', 102, '31906_833502_1572869830');
$tim->message
->setTIMTextElem('在吗')
->setTIMLocationElem('someinfo', 29.340656774469956, 116.77497920478824)
->setTIMFaceElem(1, 'content')
->setTIMCustomElem('message', 'notification', 'url', 'dingdong.aiff')
->setTIMSoundElem('sound_url')
->setTIMImageElem('image_url')
->setTIMFileElem('file_url')
->setTIMVideoFileElem('video_url', 'thumb_url')
->setCloudCustomData('云端保存消息')
->modifyMsg('101', 102, '31906_833502_1572869830');