| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- use Illuminate\Support\Facades\Route;
- use App\Module\ThirdParty\Controllers\WebhookDispatchController;
- /**
- * ThirdParty模块Webhook路由
- *
- * 路由前缀: /thirdParty/webhook
- * 实现路由规则:/thirdParty/webhook/{包名}/{Handler路由}
- */
- // Webhook分发路由
- Route::post('/{packageName}/{handlerRoute}', [WebhookDispatchController::class, 'dispatch'])
- ->name('webhook.dispatch')
- ->where('packageName', '[a-zA-Z][a-zA-Z0-9_]*')
- ->where('handlerRoute', '[a-zA-Z0-9_\/]+')
- ->middleware(['throttle:60,1']);
- // 支持多级Handler路由
- Route::post('/{packageName}/{handlerRoute}/{subRoute}', [WebhookDispatchController::class, 'dispatch'])
- ->name('webhook.dispatch.sub')
- ->where('packageName', '[a-zA-Z][a-zA-Z0-9_]*')
- ->where('handlerRoute', '[a-zA-Z0-9_]+')
- ->where('subRoute', '[a-zA-Z0-9_\/]+')
- ->middleware(['throttle:60,1']);
- // 健康检查接口
- Route::get('/health', [WebhookDispatchController::class, 'health'])
- ->name('webhook.health');
- // 获取已注册包列表接口
- Route::get('/packages', [WebhookDispatchController::class, 'packages'])
- ->name('webhook.packages')
- ->middleware(['auth:admin']);
|