Browse Source

update trojan server

Tokumeikoi 4 years ago
parent
commit
da98dcad9c
2 changed files with 3 additions and 1 deletions
  1. 1 0
      app/Services/OrderService.php
  2. 2 1
      app/Utils/Helper.php

+ 1 - 0
app/Services/OrderService.php

@@ -133,6 +133,7 @@ class OrderService
             $orderSurplusMonth = $orderSurplusMonth + $strToMonth[$item->cycle];
             $orderSurplusAmount = $orderSurplusAmount + ($item['total_amount'] + $item['balance_amount']);
         }
+        if (!$orderSurplusMonth || !$orderSurplusAmount) return;
         $monthUnitPrice = $orderSurplusAmount / $orderSurplusMonth;
         // 如果用户过期月大于订单过期月
         if ($userSurplusMonth > $orderSurplusMonth) {

+ 2 - 1
app/Utils/Helper.php

@@ -3,6 +3,7 @@
 namespace App\Utils;
 
 use App\Models\Server;
+use App\Models\ServerTrojan;
 use App\Models\User;
 
 class Helper
@@ -56,7 +57,7 @@ class Helper
         return $str;
     }
 
-    public static function buildTrojanLink(Server $server, User $user)
+    public static function buildTrojanLink(ServerTrojan $server, User $user)
     {
         $uri = "trojan://{$user->uuid}@{$server->host}:{$server->port}";
         $uri .= "\r\n";