43 lines
842 B
PHP
43 lines
842 B
PHP
<?php
|
|
/**
|
|
* Author: cfn <cfn@leapy.cn>
|
|
*/
|
|
|
|
namespace App\Utils;
|
|
|
|
use App\Service\QueueService;
|
|
use Hyperf\Di\Annotation\Inject;
|
|
|
|
/**
|
|
* Author: cfn <cfn@leapy.cn>
|
|
*/
|
|
class QueueClient
|
|
{
|
|
#[Inject]
|
|
protected QueueService $queueService;
|
|
|
|
/**
|
|
* 静态调用
|
|
* Author: cfn <cfn@leapy.cn>
|
|
* @param $name
|
|
* @param $arguments
|
|
* @return void
|
|
*/
|
|
public static function __callStatic($name, $arguments)
|
|
{
|
|
(new self())->$name(...$arguments);
|
|
}
|
|
|
|
/**
|
|
* 异步队列推送
|
|
* Author: cfn <cfn@leapy.cn>
|
|
* @param string $queue_name
|
|
* @param array $params
|
|
* @param int $delay
|
|
* @return void
|
|
*/
|
|
protected function push(string $queue_name, array $params, int $delay = 0): void
|
|
{
|
|
$this->queueService->push($queue_name, $params, $delay);
|
|
}
|
|
} |