From 6ba4702539d81c3b4109760756bbc460b25c38bf Mon Sep 17 00:00:00 2001 From: Tokumeikoi Date: Fri, 28 Feb 2020 16:11:26 +0800 Subject: [PATCH] fix replace the negative subscription problem --- app/Http/Controllers/User/OrderController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/User/OrderController.php b/app/Http/Controllers/User/OrderController.php index f998e6ec..da4d2008 100755 --- a/app/Http/Controllers/User/OrderController.php +++ b/app/Http/Controllers/User/OrderController.php @@ -89,7 +89,8 @@ class OrderController extends Controller $trafficUnitPrice = $trafficUnitPrice - ($trafficUnitPrice * $user->discount / 100); } $notUsedTrafficPrice = $plan->transfer_enable - (($user->u + $user->d) / 1073741824); - return $trafficUnitPrice * $notUsedTrafficPrice; + $result = $trafficUnitPrice * $notUsedTrafficPrice; + return $result ? $result : 0; } private function getSurplusValueByCycle(User $user, Plan $plan) @@ -109,7 +110,8 @@ class OrderController extends Controller $dayPrice = $dayPrice - ($dayPrice * $user->discount / 100); } $remainingDay = $user->expired_at - time(); - return $remainingDay * $dayPrice; + $result = $remainingDay * $dayPrice; + return $result ? $result : 0; } public function save(OrderSave $request)