This commit is contained in:
2021-07-13 11:28:12 +08:00
parent e42c2b442f
commit 6b3be1b0f9
3 changed files with 4 additions and 49 deletions
-40
View File
@@ -1,40 +0,0 @@
<?php
namespace HttpServer;
use Exception;
use Snowflake\Abstracts\Component;
use Snowflake\Snowflake;
/**
* Class Emit
* @package HttpServer
*/
class Emit extends Component
{
private array $_array = [];
/**
* @param int[] $users
* @param string $message
* @throws Exception
*/
public function emit(array $users, string $message)
{
$table = Snowflake::app()->getTable('SYSTEM:ONLINE:PEOPLES');
foreach ($users as $user) {
$fd = $table->get((string)$user, ['clientId']);
Snowflake::push($fd, $message);
}
}
}
-2
View File
@@ -9,7 +9,6 @@ use Database\DatabasesProviders;
use HttpServer\Client\Client;
use HttpServer\Client\Curl;
use HttpServer\Client\Http2;
use HttpServer\Emit;
use HttpServer\Http\Request;
use HttpServer\Http\Response;
use HttpServer\HttpFilter;
@@ -52,7 +51,6 @@ use Rpc\Producer as RPCProducer;
* @property RPCProducer $rpc
* @property Channel $channel
* @property Shutdown $shutdown
* @property Emit $emit
* @property Pool $clientsPool
*/
trait TraitApplication
+4 -7
View File
@@ -21,13 +21,10 @@ use Snowflake\Abstracts\BaseApplication;
use Snowflake\Abstracts\Config;
use Snowflake\Abstracts\Input;
use Snowflake\Abstracts\Kernel;
use Snowflake\Core\Json;
use Snowflake\Crontab\CrontabProviders;
use Snowflake\Exception\NotFindClassException;
use stdClass;
use Swoole\Timer;
use Wchat\WchatProviders;
use function Co\run;
/**
* Class Init
@@ -106,10 +103,10 @@ class Application extends BaseApplication
}
/**
* @param $kernel
* @return $this
*/
/**
* @param Kernel $kernel
* @return $this
*/
public function commands(Kernel $kernel): static
{
foreach ($kernel->getCommands() as $command) {