Compare commits

..

4 Commits

Author SHA1 Message Date
李东云
0f7b9464c9 chore(release): 1.0.0-beta.11 2025-07-11 16:36:06 +08:00
李东云
bf40c6e681 feat: 新增SP相关配置的枚举
- 添加 EnvConfiguration 接口,定义开发和生产环境常量
- 添加 ServiceProviderConfiguration 接口,继承环境和站点配置接口
- 添加 SiteConfiguration接口,定义中国和北美站点常量

Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2025-07-11 16:34:10 +08:00
李东云
9a8575b382 chore(release): 1.0.0-beta.10 2025-07-09 14:36:33 +08:00
李东云
c6ab9db698 feat(core): 添加 X-SP-ID 解析中间件
- 新增 SpParseMiddleware 类,用于解析请求中的 X-SP-ID 头- 将解析后的 SP ID存入 Hyperf 上下文中,供后续使用
- 此中间件适用于需要根据 SP ID 进行权限控制或日志记录的场景

Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2025-07-09 14:36:11 +08:00
7 changed files with 92 additions and 2 deletions

View File

@@ -1,4 +1,18 @@
# 版本更新日志
## [1.0.0-beta.11](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-beta.10...v1.0.0-beta.11) (2025-07-11)
### ✨ Features | 新功能
* 新增SP相关配置的枚举 ([bf40c6e](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/bf40c6e681cb1ff37a8fc331a3cd0cdb495e6ff1))
## [1.0.0-beta.10](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-beta.9...v1.0.0-beta.10) (2025-07-09)
### ✨ Features | 新功能
* **core:** 添加 X-SP-ID 解析中间件 ([c6ab9db](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/c6ab9db69810bcd395c52cc304dffa54978d6e84))
## [1.0.0-beta.9](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-beta.8...v1.0.0-beta.9) (2025-07-07)

View File

@@ -1 +1 @@
1.0.0-beta.9
1.0.0-beta.11

View File

@@ -136,5 +136,5 @@
"url": "https://mirrors.aliyun.com/composer/"
}
},
"version": "1.0.0-beta.9"
"version": "1.0.0-beta.11"
}

View File

@@ -0,0 +1,16 @@
<?php
/**
* EnvConfiguration.php@Core
*
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
* Powered by PhpStorm
* Created on 2025/7/11
*/
namespace Singularity\HDK\Core\Enumerations\Sp;
interface EnvConfiguration
{
public const DEVELOPMENT = 'development';
public const PRODUCTION = 'production';
}

View File

@@ -0,0 +1,12 @@
<?php
/**
* ServiceProviderConfiguration.php@Core
*
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
* Powered by PhpStorm
* Created on 2025/7/11
*/
namespace Singularity\HDK\Core\Enumerations\Sp;
interface ServiceProviderConfiguration extends EnvConfiguration, SiteConfiguration {}

View File

@@ -0,0 +1,16 @@
<?php
/**
* SiteConfigration.php@Core
*
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
* Powered by PhpStorm
* Created on 2025/7/11
*/
namespace Singularity\HDK\Core\Enumerations\Sp;
interface SiteConfiguration
{
public const CN = 'CN';
public const NA = 'NA';
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* SpParseMiddleware.php@Core
*
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
* Powered by PhpStorm
* Created on 2025/7/9
*/
declare(strict_types=1);
namespace Singularity\HDK\Core\Middleware;
use Hyperf\Context\Context;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
final class SpParseMiddleware implements MiddlewareInterface
{
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$sp = $request->getHeaderLine('X-SP-ID');
if (!empty($sp)) {
Context::set('sp', $sp);
}
return $handler->handle($request);
}
}