Tokumeikoi 5 years ago
parent
commit
c271647ecc
1 changed files with 4 additions and 3 deletions
  1. 4 3
      app/Http/Controllers/User/OrderController.php

+ 4 - 3
app/Http/Controllers/User/OrderController.php

@@ -77,9 +77,10 @@ class OrderController extends Controller
     private function getSurplusValue(User $user)
     {
         $plan = Plan::find($user->plan_id);
-        switch ($plan->type) {
-            case 0: return $this->getSurplusValueByCycle($user, $plan);
-            case 1: return $this->getSurplusValueByOneTime($user, $plan);
+        if ($user->expired_at === NULL) {
+            return $this->getSurplusValueByOneTime($user, $plan);
+        } else {
+            return $this->getSurplusValueByCycle($user, $plan);
         }
     }