package com.fs.app.controller.course;

import com.fs.common.core.domain.R;
import com.fs.common.core.domain.ResponseResult;
import com.fs.course.param.FsUserCourseVideoFinishUParam;
import com.fs.course.param.newfs.FsUserCourseVideoLinkParam;
import com.fs.course.service.IFsUserCourseService;
import com.fs.course.service.IFsUserCourseVideoService;
import com.fs.course.vo.FsUserCourseVideoH5VO;
import com.fs.course.vo.newfs.FsUserCourseVideoLinkDetailsVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api("会员-看课接口")
@RestController
@RequestMapping(value = "/app/course/xsy")
public class XiaoShouYiCourseController {

    @Autowired
    private IFsUserCourseService courseService;
    @Autowired
    private IFsUserCourseVideoService courseVideoService;

    @ApiOperation("h5课程简介")
    @GetMapping("/getH5CourseByVideoId")
    public R getCourseByVideoId(@RequestParam("videoId") Long videoId)
    {
        FsUserCourseVideoH5VO course = courseService.selectFsUserCourseVideoH5VOByVideoId(videoId);
        return R.ok().put("data",course);
    }

    @ApiOperation("H5课程详情")
    @GetMapping("/videoDetails")
    public ResponseResult<FsUserCourseVideoLinkDetailsVO> getCourseVideoDetails(FsUserCourseVideoLinkParam param) {
        return courseVideoService.getXiaoShouYiCourseVideoDetails(param);
    }

    @ApiOperation("获取缓冲流量")
    @PostMapping("/getInternetTraffic")
    public R getInternetTraffic(@RequestBody FsUserCourseVideoFinishUParam param) {
        return courseVideoService.getInternetTraffic(param);
    }
}
