Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/Services/OrderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ public static function createFromRequest(

$orderService->setVipDiscount($user);
$orderService->setOrderType($user);
$orderService->setInvite(user: $user);

if ($user->balance && $order->total_amount > 0) {
$orderService->handleUserBalance($user, $userService);
}

$orderService->setInvite(user: $user);

if (!$order->save()) {
throw new ApiException(__('Failed to create order'));
}
Expand Down
5 changes: 5 additions & 0 deletions app/Services/PlanService.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,12 @@ protected function validatePlanAvailability(User $user): void
}

if (!$this->plan->show && $this->plan->renew && !app(UserService::class)->isAvailable($user)) {
// 只有当用户不是当前套餐时才拒绝
if ($user->plan_id !== $this->plan->id) {
throw new ApiException(__('This subscription has expired, please change to another subscription'));
}
// 如果是续费原套餐,允许操作
return;
}
}

Expand Down