改名
This commit is contained in:
@@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -9,7 +9,6 @@ use Database\DatabasesProviders;
|
|||||||
use HttpServer\Client\Client;
|
use HttpServer\Client\Client;
|
||||||
use HttpServer\Client\Curl;
|
use HttpServer\Client\Curl;
|
||||||
use HttpServer\Client\Http2;
|
use HttpServer\Client\Http2;
|
||||||
use HttpServer\Emit;
|
|
||||||
use HttpServer\Http\Request;
|
use HttpServer\Http\Request;
|
||||||
use HttpServer\Http\Response;
|
use HttpServer\Http\Response;
|
||||||
use HttpServer\HttpFilter;
|
use HttpServer\HttpFilter;
|
||||||
@@ -52,7 +51,6 @@ use Rpc\Producer as RPCProducer;
|
|||||||
* @property RPCProducer $rpc
|
* @property RPCProducer $rpc
|
||||||
* @property Channel $channel
|
* @property Channel $channel
|
||||||
* @property Shutdown $shutdown
|
* @property Shutdown $shutdown
|
||||||
* @property Emit $emit
|
|
||||||
* @property Pool $clientsPool
|
* @property Pool $clientsPool
|
||||||
*/
|
*/
|
||||||
trait TraitApplication
|
trait TraitApplication
|
||||||
|
|||||||
@@ -21,13 +21,10 @@ use Snowflake\Abstracts\BaseApplication;
|
|||||||
use Snowflake\Abstracts\Config;
|
use Snowflake\Abstracts\Config;
|
||||||
use Snowflake\Abstracts\Input;
|
use Snowflake\Abstracts\Input;
|
||||||
use Snowflake\Abstracts\Kernel;
|
use Snowflake\Abstracts\Kernel;
|
||||||
use Snowflake\Core\Json;
|
|
||||||
use Snowflake\Crontab\CrontabProviders;
|
use Snowflake\Crontab\CrontabProviders;
|
||||||
use Snowflake\Exception\NotFindClassException;
|
use Snowflake\Exception\NotFindClassException;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
use Swoole\Timer;
|
use Swoole\Timer;
|
||||||
use Wchat\WchatProviders;
|
|
||||||
use function Co\run;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Init
|
* Class Init
|
||||||
@@ -106,10 +103,10 @@ class Application extends BaseApplication
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $kernel
|
* @param Kernel $kernel
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function commands(Kernel $kernel): static
|
public function commands(Kernel $kernel): static
|
||||||
{
|
{
|
||||||
foreach ($kernel->getCommands() as $command) {
|
foreach ($kernel->getCommands() as $command) {
|
||||||
|
|||||||
Reference in New Issue
Block a user