| | |
| | | package com.tcm.training.admin.app.course.controller; |
| | | |
| | | import com.tcm.training.admin.app.course.dto.AppHealthCoursePurchaseRequest; |
| | | import com.tcm.training.admin.app.course.service.AppHealthCourseService; |
| | | import com.tcm.training.admin.app.course.vo.AppHealthCourseCategoryOptionVO; |
| | | import com.tcm.training.admin.app.course.vo.AppHealthCourseDetailVO; |
| | | import com.tcm.training.admin.app.course.vo.AppHealthCourseFavoriteResultVO; |
| | | import com.tcm.training.admin.app.course.vo.AppHealthCourseListItemVO; |
| | | import com.tcm.training.admin.app.course.vo.AppHealthCoursePurchaseResultVO; |
| | | import com.tcm.training.admin.common.ApiResponse; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 收藏 APP 养生课程。 |
| | | */ |
| | | @PostMapping("/health-courses/{courseId}/favorite") |
| | | public ApiResponse<AppHealthCourseFavoriteResultVO> favorite(@PathVariable("courseId") Long courseId) { |
| | | return ApiResponse.ok(appHealthCourseService.favorite(courseId)); |
| | | } |
| | | |
| | | /** |
| | | * 取消收藏 APP 养生课程。 |
| | | */ |
| | | @DeleteMapping("/health-courses/{courseId}/favorite") |
| | | public ApiResponse<AppHealthCourseFavoriteResultVO> cancelFavorite(@PathVariable("courseId") Long courseId) { |
| | | return ApiResponse.ok(appHealthCourseService.cancelFavorite(courseId)); |
| | | } |
| | | |
| | | /** |
| | | * 购买 APP 养生课程整课。 |
| | | */ |
| | | @PostMapping("/health-courses/{courseId}/purchase") |
| | | public ApiResponse<AppHealthCoursePurchaseResultVO> purchaseCourse(@PathVariable("courseId") Long courseId, |
| | | @Valid @RequestBody AppHealthCoursePurchaseRequest request) { |
| | | return ApiResponse.ok(appHealthCourseService.purchaseCourse(courseId, request)); |
| | | } |
| | | |
| | | /** |
| | | * 购买 APP 养生课程小节。 |
| | | */ |
| | | @PostMapping("/health-courses/{courseId}/videos/{videoId}/purchase") |
| | | public ApiResponse<AppHealthCoursePurchaseResultVO> purchaseVideo(@PathVariable("courseId") Long courseId, |
| | | @PathVariable("videoId") Long videoId, |
| | | @Valid @RequestBody AppHealthCoursePurchaseRequest request) { |
| | | return ApiResponse.ok(appHealthCourseService.purchaseVideo(courseId, videoId, request)); |
| | | } |
| | | |
| | | /** |
| | | * 会员将 APP 养生课程加入我的课程。 |
| | | */ |
| | | @PostMapping("/health-courses/{courseId}/member-join") |
| | | public ApiResponse<Boolean> memberJoinCourse(@PathVariable("courseId") Long courseId) { |
| | | return ApiResponse.ok(Boolean.valueOf(appHealthCourseService.memberJoinCourse(courseId))); |
| | | } |
| | | |
| | | /** |
| | | * 获取 APP 养生课程主题筛选项。 |
| | | */ |
| | | @GetMapping("/health-course-themes") |