Ver Fonte

fixed:删除无用dto目录、简化cors配置

FelixYinMac há 4 meses atrás
pai
commit
084661257c
2 ficheiros alterados com 8 adições e 85 exclusões
  1. 0 34
      app/DTO/OrderAmount.php
  2. 8 51
      config/cors.php

+ 0 - 34
app/DTO/OrderAmount.php

@@ -1,34 +0,0 @@
-<?php
-
-namespace App\DTO;
-
-class OrderAmount
-{
-    public float $total_amount;
-
-    public float $balance_amount;
-
-    public float $pay_amount;
-
-    public float $coupon_amount;
-
-    public float $project_amount;
-
-    public float $delivery_fee;
-
-    public function __construct(
-        float $total_amount,
-        float $balance_amount,
-        float $pay_amount,
-        float $coupon_amount,
-        float $project_amount,
-        float $delivery_fee
-    ) {
-        $this->total_amount = $total_amount;
-        $this->balance_amount = $balance_amount;
-        $this->pay_amount = $pay_amount;
-        $this->coupon_amount = $coupon_amount;
-        $this->project_amount = $project_amount;
-        $this->delivery_fee = $delivery_fee;
-    }
-}

+ 8 - 51
config/cors.php

@@ -1,54 +1,11 @@
 <?php
-
 return [
-    // 指定哪些路由需要 CORS
-    'paths' => [
-        '*',                    // 所有路由
-        'api/*',                 // API 路由
-        'sanctum/csrf-cookie',   // Sanctum 认证
-        'login',                 // 登录路由
-        'register',              // 注册路由
-    ],
-
-    // 允许的请求方法
-    'allowed_methods' => ['*', 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
-
-    // 允许的来源域名
-    'allowed_origins' => [
-        '*',
-        'http://127.0.0.1',
-        'http://localhost',
-        env('APP_ENV') === 'local'
-            ? ['http://localhost:3000', 'http://localhost:8080', 'http://127.0.0.1:8000', '*']
-            : [env('FRONTEND_URL'), '*'],
-    ],
-
-    // 允许的域名模式(支持通配符)
-    'allowed_origins_patterns' => [
-        // 'https://*.your-domain.com',
-    ],
-
-    // 允许的请求头
-    'allowed_headers' => [
-        '*',
-        'Accept',
-        'Authorization',
-        'Content-Type',
-        'X-Requested-With',
-        'X-CSRF-TOKEN',
-        'X-Custom-Header',
-        env('APP_ENV') === 'local' ? 'X-Debug-Token' : null,
-    ],
-
-    // 暴露给客户端的响应头
-    'exposed_headers' => [
-        '*',
-        'X-Custom-Response-Header',
-    ],
-
-    // 预检请求缓存时间(秒)
-    'max_age' => 86400,
-
-    // 是否允许携带认证信息(cookies等)
-    'supports_credentials' => env('CORS_SUPPORTS_CREDENTIALS', true),
+    'paths' => ['api/*'],
+    'allowed_methods' => ['*'],
+    'allowed_origins' => ['*'],
+    'allowed_origins_patterns' => [],
+    'allowed_headers' => ['*'],
+    'exposed_headers' => [],
+    'max_age' => 0,
+    'supports_credentials' => true,
 ];