增加基础配置
Some checks failed
Build Docker / build (push) Has been cancelled

This commit is contained in:
2025-07-12 11:59:33 +08:00
parent fb50096e66
commit 8a3ab17b25
44 changed files with 1599 additions and 66 deletions

View File

@ -0,0 +1,54 @@
<?php
/**
* Author: ykxiao
* Date: 2025/7/11
* Time: 下午9:00
* 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/7/11
* Time: 下午9:00
* Description: ApiUrlContext. 请求url上下文
*
* (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 ApiUrlContext
{
private const string API_URL_KEY = 'api_url';
public static function setApiUrl(string $apiUrl): void
{
Context::set(self::API_URL_KEY, $apiUrl);
}
public static function getApiUrl(): ?string
{
return Context::get(self::API_URL_KEY);
}
public static function clearApiUrl(): void
{
Context::set(self::API_URL_KEY, null);
}
public static function hasApiUrl(): bool
{
return Context::has(self::API_URL_KEY);
}
}

View File

@ -44,25 +44,6 @@ class QueueContext
return Context::get(self::USER_KEY);
}
/**
* 设置当前公司信息
* @param array $companyInfo
* @return void
*/
public static function setCompanyInfo(array $companyInfo): void
{
Context::set(self::COMPANY_KEY, $companyInfo);
}
/**
* 获取当前公司信息
* @return array|null
*/
public static function getCompanyInfo(): ?array
{
return Context::get(self::COMPANY_KEY);
}
public static function clear(): void
{
Context::destroy(self::USER_KEY);

View File

@ -35,7 +35,7 @@ class UserContext
public static function setCurrentUser(array|string|int $user): void
{
$companyRepository = make(FirstCompanyRepository::class);
if (!empty($companyInfo = $companyRepository->getCompanyByFullName($user['user']['full_name']))) {
if (!empty($companyInfo = $companyRepository->getCompanyByFullName($user['full_name'], false))) {
$user['company'] = $companyInfo;
}