| | |
| | | AppUser user = requireEnabledUser(userId); |
| | | HealthCourse course = requireEnabledCourse(courseId); |
| | | String paymentMethod = normalizePaymentMethod(request == null ? null : request.getPaymentMethod()); |
| | | if (course.getSalePrice() == null || course.getSalePrice().compareTo(BigDecimal.ZERO) <= 0) { |
| | | throw new IllegalArgumentException("当前课程无需购买"); |
| | | } |
| | | CoursePurchaseOrder existingOrder = findLatestActivePaidCourseOrder(userId, courseId); |
| | | if (existingOrder != null) { |
| | | return buildPurchaseResult(existingOrder, true, resolvePurchasedVideoIds(userId, courseId, true)); |