123456789101112131415161718192021222324252627282930 |
- package cn.rankin.apiweb.controller;
- import cn.rankin.apiweb.assist.resolver.NeedUser;
- import cn.rankin.apiweb.service.auth.AuthService;
- import cn.rankin.apiweb.service.product.ProductService;
- import cn.rankin.common.utils.api.model.APIResult;
- import cn.rankin.data.api.app.vo.DeviceUserVo;
- import cn.rankin.data.api.app.vo.LessonVo;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- @RestController
- @RequestMapping(value = "/lesson")
- public class LessonController {
- @Autowired
- private ProductService productService;
- @Autowired
- private AuthService authService;
- @RequestMapping(value = "/{lessonId}", method = RequestMethod.GET)
- public APIResult<LessonVo> getLesson(@NeedUser DeviceUserVo user, @PathVariable("lessonId") String lessonId, @RequestParam("courseId") String courseId) {
- String userId = user.getUid();
- String merchantId = user.getMerchantId();
- // 加入鉴权
- Boolean auth = authService.isValid(userId, merchantId, courseId);
- return productService.getLesson(lessonId, courseId, auth);
- }
- }
|