|
|
@@ -2,7 +2,7 @@
|
|
|
|
|
|
namespace App\Module\OpenAPI\Services;
|
|
|
|
|
|
-use Illuminate\Support\ServiceProvider;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* Handler注册服务
|
|
|
@@ -14,42 +14,42 @@ class HandlerRegistrationService
|
|
|
/**
|
|
|
* 注册所有Handler到服务容器
|
|
|
*
|
|
|
- * @param ServiceProvider $provider
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function registerHandlers(ServiceProvider $provider): void
|
|
|
+ public function registerHandlers(): void
|
|
|
{
|
|
|
// 注册用户相关Handler
|
|
|
- $this->registerUserHandlers($provider);
|
|
|
-
|
|
|
+ $this->registerUserHandlers();
|
|
|
+
|
|
|
// 注册游戏相关Handler
|
|
|
- $this->registerGameHandlers($provider);
|
|
|
-
|
|
|
+ $this->registerGameHandlers();
|
|
|
+
|
|
|
// 注册资金相关Handler
|
|
|
- $this->registerFundHandlers($provider);
|
|
|
-
|
|
|
+ $this->registerFundHandlers();
|
|
|
+
|
|
|
// 注册物品相关Handler(待实现)
|
|
|
- $this->registerItemHandlers($provider);
|
|
|
-
|
|
|
+ $this->registerItemHandlers();
|
|
|
+
|
|
|
// 注册交易相关Handler(待实现)
|
|
|
- $this->registerTradeHandlers($provider);
|
|
|
+ $this->registerTradeHandlers();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 注册用户相关Handler
|
|
|
*
|
|
|
- * @param ServiceProvider $provider
|
|
|
* @return void
|
|
|
*/
|
|
|
- protected function registerUserHandlers(ServiceProvider $provider): void
|
|
|
+ protected function registerUserHandlers(): void
|
|
|
{
|
|
|
- $provider->app->singleton(\App\Module\OpenAPI\Handlers\User\UserInfoHandler::class, function ($app) {
|
|
|
+ $app = app();
|
|
|
+
|
|
|
+ $app->singleton(\App\Module\OpenAPI\Handlers\User\UserInfoHandler::class, function ($app) {
|
|
|
return new \App\Module\OpenAPI\Handlers\User\UserInfoHandler(
|
|
|
$app->make(\App\Module\OpenAPI\Services\ScopeService::class)
|
|
|
);
|
|
|
});
|
|
|
|
|
|
- $provider->app->singleton(\App\Module\OpenAPI\Handlers\User\UserListHandler::class, function ($app) {
|
|
|
+ $app->singleton(\App\Module\OpenAPI\Handlers\User\UserListHandler::class, function ($app) {
|
|
|
return new \App\Module\OpenAPI\Handlers\User\UserListHandler(
|
|
|
$app->make(\App\Module\OpenAPI\Services\ScopeService::class)
|
|
|
);
|
|
|
@@ -59,12 +59,13 @@ class HandlerRegistrationService
|
|
|
/**
|
|
|
* 注册游戏相关Handler
|
|
|
*
|
|
|
- * @param ServiceProvider $provider
|
|
|
* @return void
|
|
|
*/
|
|
|
- protected function registerGameHandlers(ServiceProvider $provider): void
|
|
|
+ protected function registerGameHandlers(): void
|
|
|
{
|
|
|
- $provider->app->singleton(\App\Module\OpenAPI\Handlers\Game\GameStatsHandler::class, function ($app) {
|
|
|
+ $app = app();
|
|
|
+
|
|
|
+ $app->singleton(\App\Module\OpenAPI\Handlers\Game\GameStatsHandler::class, function ($app) {
|
|
|
return new \App\Module\OpenAPI\Handlers\Game\GameStatsHandler(
|
|
|
$app->make(\App\Module\OpenAPI\Services\ScopeService::class)
|
|
|
);
|
|
|
@@ -74,12 +75,13 @@ class HandlerRegistrationService
|
|
|
/**
|
|
|
* 注册资金相关Handler
|
|
|
*
|
|
|
- * @param ServiceProvider $provider
|
|
|
* @return void
|
|
|
*/
|
|
|
- protected function registerFundHandlers(ServiceProvider $provider): void
|
|
|
+ protected function registerFundHandlers(): void
|
|
|
{
|
|
|
- $provider->app->singleton(\App\Module\OpenAPI\Handlers\Fund\FundBalanceHandler::class, function ($app) {
|
|
|
+ $app = app();
|
|
|
+
|
|
|
+ $app->singleton(\App\Module\OpenAPI\Handlers\Fund\FundBalanceHandler::class, function ($app) {
|
|
|
return new \App\Module\OpenAPI\Handlers\Fund\FundBalanceHandler(
|
|
|
$app->make(\App\Module\OpenAPI\Services\ScopeService::class)
|
|
|
);
|
|
|
@@ -89,25 +91,23 @@ class HandlerRegistrationService
|
|
|
/**
|
|
|
* 注册物品相关Handler(待实现)
|
|
|
*
|
|
|
- * @param ServiceProvider $provider
|
|
|
* @return void
|
|
|
*/
|
|
|
- protected function registerItemHandlers(ServiceProvider $provider): void
|
|
|
+ protected function registerItemHandlers(): void
|
|
|
{
|
|
|
// TODO: 实现物品相关Handler
|
|
|
- // $provider->app->singleton(\App\Module\OpenAPI\Handlers\Item\ItemListHandler::class, ...);
|
|
|
+ // app()->singleton(\App\Module\OpenAPI\Handlers\Item\ItemListHandler::class, ...);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 注册交易相关Handler(待实现)
|
|
|
*
|
|
|
- * @param ServiceProvider $provider
|
|
|
* @return void
|
|
|
*/
|
|
|
- protected function registerTradeHandlers(ServiceProvider $provider): void
|
|
|
+ protected function registerTradeHandlers(): void
|
|
|
{
|
|
|
// TODO: 实现交易相关Handler
|
|
|
- // $provider->app->singleton(\App\Module\OpenAPI\Handlers\Trade\TradeHistoryHandler::class, ...);
|
|
|
+ // app()->singleton(\App\Module\OpenAPI\Handlers\Trade\TradeHistoryHandler::class, ...);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -156,7 +156,7 @@ class HandlerRegistrationService
|
|
|
{
|
|
|
$handlers = $this->getRegisteredHandlers();
|
|
|
|
|
|
- foreach ($handlers as $category => $categoryHandlers) {
|
|
|
+ foreach ($handlers as $categoryHandlers) {
|
|
|
if (in_array($handlerClass, $categoryHandlers)) {
|
|
|
return true;
|
|
|
}
|