diff --git a/app/Http/Controllers/User/OrderController.php b/app/Http/Controllers/User/OrderController.php index 36daf4cf..bd8815ae 100755 --- a/app/Http/Controllers/User/OrderController.php +++ b/app/Http/Controllers/User/OrderController.php @@ -98,21 +98,21 @@ class OrderController extends Controller private function getSurplusValueByCycle(User $user, Plan $plan) { $dayPrice = 0; + $day = ($user->expired_at - time()) / 86400; if ($plan->month_price) { - $dayPrice = $plan->month_price / 2592000; + $dayPrice = $plan->month_price / $day; } else if ($plan->quarter_price) { - $dayPrice = $plan->quarter_price / 7862400; + $dayPrice = $plan->quarter_price / $day; } else if ($plan->half_year_price) { - $dayPrice = $plan->half_year_price / 15811200; + $dayPrice = $plan->half_year_price / $day; } else if ($plan->year_price) { - $dayPrice = $plan->year_price / 31536000; + $dayPrice = $plan->year_price / $day; } // exclude discount if ($user->discount && $dayPrice) { $dayPrice = $dayPrice - ($dayPrice * $user->discount / 100); } - $remainingDay = $user->expired_at - time(); - $result = $remainingDay * $dayPrice; + $result = $day * $dayPrice; return $result > 0 ? $result : 0; } diff --git a/database/update.sql b/database/update.sql index 4c2d761d..47aa0b9c 100644 --- a/database/update.sql +++ b/database/update.sql @@ -200,3 +200,7 @@ ADD `tlsSettings` text COLLATE 'utf8_general_ci' NULL AFTER `tls`; ALTER TABLE `v2_order` ADD `balance_amount` int(11) NULL COMMENT '使用余额' AFTER `refund_amount`; + +ALTER TABLE `v2_server` +CHANGE `network` `network` text COLLATE 'utf8_general_ci' NOT NULL AFTER `rate`, +ADD `dnsSettings` text COLLATE 'utf8_general_ci' NULL AFTER `ruleSettings`;