Request::class, 'think\exception\Handle' => ExceptionHandle::class, /* ---------------- 评分引擎 ---------------- */ ScoreStrategyFactory::class => fn () => new ScoreStrategyFactory(config('score')), ScoreEngine::class => fn (Container $app) => new ScoreEngine( $app->make(ScoreStrategyFactory::class) ), // 评分引擎的对外门面:控制器只注入它,拿不到策略细节 ScoreService::class => fn (Container $app) => new ScoreService( $app->make(ScoreEngine::class) ), /* ---------------- 账号体系 ---------------- */ JwtService::class => fn () => new JwtService( (string) config('jwt.secret'), (int) config('jwt.ttl') ), // 第二个参数是调试标志:WxService 用它拦住「生产开着 mock」这种致命配置 WxService::class => fn () => new WxService( (array) config('wx'), (bool) env('app_debug', false) ), ];