This commit is contained in:
2025-06-26 09:56:14 +08:00
parent 274c798ac8
commit 3ac275bd9b
7 changed files with 115 additions and 19 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Services\GatewayWorker;
use App\Enum\MessageTypeEnum;
use App\Services\Base\BaseService;
class ImService extends BaseService
@@ -17,4 +18,16 @@ class ImService extends BaseService
return ['绑定成功'];
}
public function sendMessage($data, $type = MessageTypeEnum::Text->value)
{
$data['message_type'] = $type;
GatewayClientService::getInstance()->init()->sendToUser(
$this->userId,
$this->userId === 1? 2: 1,
$this->userInfo['nick_name'],
json_encode($data),
);
return ['发送成功'];
}
}