fix:优化auth权限,登录逻辑获取信息
This commit is contained in:
@@ -11,9 +11,17 @@ declare (strict_types=1);
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\queue\redis;
|
||||
|
||||
use app\AdminController;
|
||||
use support\Log;
|
||||
use Webman\RedisQueue\Redis;
|
||||
use Webman\RedisQueue\Client;
|
||||
|
||||
class Push extends AdminController
|
||||
/**
|
||||
* 队列任务
|
||||
* @package app\queue\redis
|
||||
* @author meystack
|
||||
* @date 2022-11-20
|
||||
*/
|
||||
class Push
|
||||
{
|
||||
/**
|
||||
* api推送
|
||||
@@ -22,19 +30,41 @@ class Push extends AdminController
|
||||
protected mixed $api;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* 同步推送
|
||||
* @param $name
|
||||
* @param $data
|
||||
* @param int $delay
|
||||
* @return bool
|
||||
*/
|
||||
public function __construct()
|
||||
public static function queue($name, $data, int $delay = 0): bool
|
||||
{
|
||||
parent::__construct();
|
||||
try {
|
||||
// 投递消息
|
||||
Redis::send($name, $data, $delay);
|
||||
} catch (\Throwable $th) {
|
||||
Log::info('redis push error:' . $th->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* 消息推送首页
|
||||
* @return mixed
|
||||
/**
|
||||
* 异步推送
|
||||
* @param $name
|
||||
* @param $data
|
||||
* @param int $delay
|
||||
* @return bool
|
||||
*/
|
||||
public function index()
|
||||
public static function client($name, $data, int $delay = 0): bool
|
||||
{
|
||||
return response('success');
|
||||
try {
|
||||
// 投递消息
|
||||
Client::send($name, $data, $delay);
|
||||
} catch (\Throwable $th) {
|
||||
Log::info('redis Client async error:' . $th->getMessage());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
41
app/queue/redis/Works.php
Normal file
41
app/queue/redis/Works.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace app\queue\redis;
|
||||
use Webman\RedisQueue\Consumer;
|
||||
|
||||
/**
|
||||
* 消费任务
|
||||
* @package app\queue\redis
|
||||
* @author meystack
|
||||
* @date 2022-11-20
|
||||
*/
|
||||
class Works implements Consumer
|
||||
{
|
||||
/**
|
||||
* 消费队列名称
|
||||
* @var string
|
||||
*/
|
||||
public string $queue = 'send-mail';
|
||||
|
||||
/**
|
||||
* REDIS连接名称
|
||||
* @param $data
|
||||
* @return bool
|
||||
*/
|
||||
public string $connection = 'default';
|
||||
|
||||
/**
|
||||
* 默认消费函数
|
||||
* @param $data
|
||||
* @return bool
|
||||
*/
|
||||
public function consume($data): bool
|
||||
{
|
||||
/**
|
||||
* 无需反序列化
|
||||
* 请在此编写您的消费逻辑
|
||||
*/
|
||||
var_dump($data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user