测试
This commit is contained in:
@@ -8,6 +8,12 @@ use App\Services\Base\BaseService;
|
||||
class ImService extends BaseService
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->gatewayClient = GatewayClientService::getInstance()->init();
|
||||
}
|
||||
|
||||
public function bindClientIdByUserId($clientId)
|
||||
{
|
||||
if (empty($clientId)) {
|
||||
@@ -22,12 +28,17 @@ class ImService extends BaseService
|
||||
public function sendMessage($data, $type = MessageTypeEnum::Text->value)
|
||||
{
|
||||
$data['message_type'] = MessageTypeEnum::from($type)->description();
|
||||
GatewayClientService::getInstance()->init()->sendToUser(
|
||||
$this->gatewayClient->sendToUser(
|
||||
$this->userId === 1? 2: 1,
|
||||
$this->userId,
|
||||
$this->userInfo['nick_name'],
|
||||
$data['content'],
|
||||
);
|
||||
$this->gatewayClient->broadcastMessage(
|
||||
$this->userId,
|
||||
$this->userInfo['nick_name'],
|
||||
$data['content'],
|
||||
);
|
||||
return ['发送成功'];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user