tokumeikoi 2 жил өмнө
parent
commit
ef366d8d8b

+ 0 - 1
app/Http/Controllers/Client/Protocols/Clash.php

@@ -121,7 +121,6 @@ class Clash
                     $array['ws-opts']['path'] = $wsSettings['path'];
                 if (isset($wsSettings['headers']['Host']) && !empty($wsSettings['headers']['Host']))
                     $array['ws-opts']['headers'] = ['Host' => $wsSettings['headers']['Host']];
-                // TODO: 2022.06.01 remove it
                 if (isset($wsSettings['path']) && !empty($wsSettings['path']))
                     $array['ws-path'] = $wsSettings['path'];
                 if (isset($wsSettings['headers']['Host']) && !empty($wsSettings['headers']['Host']))

+ 0 - 1
app/Http/Controllers/Client/Protocols/Stash.php

@@ -122,7 +122,6 @@ class Stash
                     $array['ws-opts']['path'] = $wsSettings['path'];
                 if (isset($wsSettings['headers']['Host']) && !empty($wsSettings['headers']['Host']))
                     $array['ws-opts']['headers'] = ['Host' => $wsSettings['headers']['Host']];
-                // TODO: 2022.06.01 remove it
                 if (isset($wsSettings['path']) && !empty($wsSettings['path']))
                     $array['ws-path'] = $wsSettings['path'];
                 if (isset($wsSettings['headers']['Host']) && !empty($wsSettings['headers']['Host']))

+ 6 - 2
app/Services/UserService.php

@@ -8,6 +8,7 @@ use App\Jobs\StatUserJob;
 use App\Jobs\TrafficFetchJob;
 use App\Models\InviteCode;
 use App\Models\Order;
+use App\Models\Plan;
 use App\Models\ServerV2ray;
 use App\Models\Ticket;
 use App\Models\User;
@@ -37,13 +38,13 @@ class UserService
         }
     }
 
-    private function calcResetDayByYearFirstDay()
+    private function calcResetDayByYearFirstDay(): int
     {
         $nextYear = strtotime(date("Y-01-01", strtotime('+1 year')));
         return (int)(($nextYear - time()) / 86400);
     }
 
-    private function calcResetDayByYearExpiredAt(int $expiredAt)
+    private function calcResetDayByYearExpiredAt(int $expiredAt): int
     {
         $md = date('m-d', $expiredAt);
         $nowYear = strtotime(date("Y-{$md}"));
@@ -53,6 +54,9 @@ class UserService
 
     public function getResetDay(User $user)
     {
+        if (!isset($user->plan)) {
+            $user->plan = Plan::find($user->plan_id);
+        }
         if ($user->expired_at <= time() || $user->expired_at === NULL) return null;
         // if reset method is not reset
         if ($user->plan->reset_traffic_method === 2) return null;