diff --git a/app/Console/Commands/CheckOrder.php b/app/Console/Commands/CheckOrder.php index 7f7d9e48..7dc298a5 100755 --- a/app/Console/Commands/CheckOrder.php +++ b/app/Console/Commands/CheckOrder.php @@ -83,6 +83,7 @@ class CheckOrder extends Command $user->plan_id = $plan->id; $user->group_id = $plan->group_id; $user->expired_at = $this->getTime($order->cycle, $user->expired_at); + if ($user->save()) { $order->status = 3; $order->save(); diff --git a/app/Http/Controllers/User/OrderController.php b/app/Http/Controllers/User/OrderController.php index d0c4afc0..2ab9bd3a 100755 --- a/app/Http/Controllers/User/OrderController.php +++ b/app/Http/Controllers/User/OrderController.php @@ -85,6 +85,10 @@ class OrderController extends Controller } else if ($plan->year_price) { $dayPrice = $plan->year_price / 31536000; } + // exclude discount + if ($user->discount) { + $dayPrice = $dayPrice * $user->discount / 100; + } $remainingDay = $user->expired_at - time(); return $remainingDay * $dayPrice; }