This commit is contained in:
2025-06-26 10:51:10 +08:00
parent a41967fac4
commit cfc77d29af
2 changed files with 14 additions and 11 deletions

View File

@@ -28,22 +28,24 @@ class ImService extends BaseService
public function sendMessage($data, $type = MessageTypeEnum::Text->value)
{
$uids = [1,2,3];
$uidsC = [];
foreach ($uids as $v) {
$uidsC[$v] = Gateway::getClientIdByUid($v);
}
ds($uidsC);
// $uids = [1,2,3];
// $uidsC = [];
// foreach ($uids as $v) {
// $uidsC[$v] = Gateway::getClientIdByUid($v);
// }
// ds($uidsC);
$data['message_type'] = MessageTypeEnum::from($type)->description();
$this->gatewayClient->sendToUser(
$this->userId === 1? 2: 1,
$this->userId,
$this->userInfo['nick_name'],
$data['avatarColor'],
$data['content'],
);
$this->gatewayClient->broadcastMessage(
$this->userId,
$this->userInfo['nick_name'],
$data['avatarColor'],
$data['content'],
);
return ['发送成功'];