Files
NBA/src/main/java/com/ping/study/controller/tx/LiveInfoController.java

37 lines
1.2 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.ping.study.controller.tx;
import com.ping.study.service.UrlsService;
import com.ping.study.service.tx.LiveInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/tx/nba")
@Slf4j
public class LiveInfoController {
private final LiveInfoService liveInfoService;
public LiveInfoController(LiveInfoService liveInfoService) {
this.liveInfoService = liveInfoService;
}
@GetMapping("/live/{cnlid}")
public String getLiveInfo(@PathVariable String cnlid) throws Exception {
log.info("执行查询直播id: {}", cnlid);
return liveInfoService.getLiveInfo(cnlid);
}
//定时执行更新直播链接
//定时任务 从北京时间凌晨到12:00点每过5分钟执行一次
@Scheduled(cron = "0 0/10 0-12 * * ?")
@RequestMapping("/live/refresh")
public String refreshLiveInfo() throws Exception {
log.info("=========开始执行更新直播链接=========");
return liveInfoService.refreshLiveInfo();
}
}