LessonController.java 1.1 KB

123456789101112131415161718192021222324252627282930
  1. package cn.rankin.apiweb.controller;
  2. import cn.rankin.apiweb.assist.resolver.NeedUser;
  3. import cn.rankin.apiweb.service.auth.AuthService;
  4. import cn.rankin.apiweb.service.product.ProductService;
  5. import cn.rankin.common.utils.api.model.APIResult;
  6. import cn.rankin.data.api.app.vo.DeviceUserVo;
  7. import cn.rankin.data.api.app.vo.LessonVo;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.web.bind.annotation.*;
  10. @RestController
  11. @RequestMapping(value = "/lesson")
  12. public class LessonController {
  13. @Autowired
  14. private ProductService productService;
  15. @Autowired
  16. private AuthService authService;
  17. @RequestMapping(value = "/{lessonId}", method = RequestMethod.GET)
  18. public APIResult<LessonVo> getLesson(@NeedUser DeviceUserVo user, @PathVariable("lessonId") String lessonId, @RequestParam("courseId") String courseId) {
  19. String userId = user.getUid();
  20. String merchantId = user.getMerchantId();
  21. // 加入鉴权
  22. Boolean auth = authService.isValid(userId, merchantId, courseId);
  23. return productService.getLesson(lessonId, courseId, auth);
  24. }
  25. }