Files
wh-api/app/Context/QueueContext.php
ykxiao 8a3ab17b25
Some checks failed
Build Docker / build (push) Has been cancelled
增加基础配置
2025-07-12 11:59:33 +08:00

51 lines
1004 B
PHP

<?php
/**
* Author: ykxiao
* Date: 2025/6/3
* Time: 下午6:40
* Description:
*
* (c) ykxiao <yk_9001@hotmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
declare(strict_types=1);
namespace App\Context;
use Hyperf\Context\Context;
/**
* Author: ykxiao
* Date: 2025/6/3
* Time: 下午7:19
* Description: 队列上下文
*
* (c) ykxiao <yk_9001@hotmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
class QueueContext
{
private const string USER_KEY = 'queue.user';
private const string COMPANY_KEY = 'company';
public static function setUser(array $user): void
{
Context::set(self::USER_KEY, $user);
}
public static function getUser(): ?array
{
return Context::get(self::USER_KEY);
}
public static function clear(): void
{
Context::destroy(self::USER_KEY);
}
}