package com.fs.app.controller.live;

import com.fs.common.core.domain.R;
import com.fs.live.domain.LiveVideo;
import com.fs.live.mapper.LiveVideoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 用户直播赞Controller
 *
 * @author fs
 * @date 2025-07-11
 */
@RestController
@RequestMapping("/app/live/liveVideo")
public class LiveVideoController {

    @Autowired
    private LiveVideoMapper liveVideoMapper;


    @GetMapping("/{liveId}")
    public R getVideo(@PathVariable("liveId") Long liveId,@RequestParam("videoType") Integer videoType) {
        List<LiveVideo> liveVideos = liveVideoMapper.selectByLiveIdAndType(liveId, videoType);
        if(liveVideos==null || liveVideos.isEmpty()) return R.error("没有该视频");

        return R.ok().put("liveVideos", liveVideos.get(0));
    }
}
