| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace ThirdParty\Urs;
- use Illuminate\Support\ServiceProvider;
- use App\Module\ThirdParty\Services\WebhookDispatchService;
- /**
- * URS包服务提供者
- *
- * 负责注册URS包的Webhook处理器到ThirdParty模块
- */
- class UrsServiceProvider extends ServiceProvider
- {
- /**
- * 注册服务
- *
- * @return void
- */
- public function register()
- {
- // 注册URS请求服务
- $this->app->singleton('thirdparty.urs.request', function () {
- return new UrsRequest();
- });
- }
-
- /**
- * 启动服务
- *
- * @return void
- */
- public function boot()
- {
- // 注册URS包的Webhook处理器
- $this->registerWebhookHandlers();
- }
-
- /**
- * 注册Webhook处理器
- *
- * @return void
- */
- protected function registerWebhookHandlers()
- {
- // 注册URS包的所有Webhook处理器
- WebhookDispatchService::registerPackageHandlers('urs', [
- 'register' => UrsWebhook::class,
- 'deposit' => UrsWebhook::class,
- 'withdraw' => UrsWebhook::class,
- 'check' => UrsWebhook::class,
- ]);
- }
-
- /**
- * 获取提供的服务
- *
- * @return array
- */
- public function provides()
- {
- return [
- 'thirdparty.urs.request',
- ];
- }
- }
|