|
|
@@ -11,6 +11,9 @@ use Closure;
|
|
|
use App\Game\Services\LZCompressor\LZString as LZ;
|
|
|
use App\Game\Services\LZCompressor\LZUtil;
|
|
|
|
|
|
+use Symfony\Component\HttpFoundation\Response as SymfonyResponse; // 新增
|
|
|
+use Illuminate\Http\JsonResponse; // 可选,用于数组转 JSON 响应
|
|
|
+
|
|
|
class GameEncrypt
|
|
|
{
|
|
|
/**
|
|
|
@@ -45,6 +48,16 @@ class GameEncrypt
|
|
|
$response['req']=$request->all();
|
|
|
}
|
|
|
|
|
|
+ // 如果是数组响应,统一转成 JsonResponse,避免后面 getContent() 报错 // 新增
|
|
|
+ if (is_array($response)) { // 新增
|
|
|
+ $response = response()->json($response); // 新增
|
|
|
+ } // 新增
|
|
|
+
|
|
|
+ // 如果不是一个 Symfony Response 对象,直接返回,不再做加密和加头 // 新增
|
|
|
+ if (!$response instanceof SymfonyResponse) { // 新增
|
|
|
+ return $response; // 新增
|
|
|
+ } // 新增
|
|
|
+
|
|
|
$origin = $request->server('HTTP_ORIGIN') ?? $request->server('HTTP_REFERER') ?? '*';
|
|
|
|
|
|
if($hasLz&&!RouteService::isTestSite()&&!$debug) {
|