package com.yeshi.buwan.job.video;
|
|
import com.xxl.job.core.biz.model.ReturnT;
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
import com.yeshi.buwan.service.inter.juhe.FunTV2Service;
|
import com.yeshi.buwan.videos.funtv.entity.FunTVShortVideo2;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import org.springframework.stereotype.Component;
|
|
import javax.annotation.Resource;
|
import java.util.ArrayList;
|
import java.util.List;
|
|
@Component
|
public class FunTV2VideoUpdate {
|
|
private final static Logger logger = LoggerFactory.getLogger(FunTV2VideoUpdate.class);
|
|
@Resource
|
private FunTV2Service funTV2Service;
|
|
|
/**
|
* 更新最近几天的视频
|
* @param param 天数
|
* @return
|
* @throws Exception
|
*/
|
@XxlJob("video-update-funtv2-updateLatestVideo")
|
public ReturnT<String> updateLatestVideo(String param) throws Exception {
|
return ReturnT.SUCCESS;
|
}
|
|
/**
|
* 获取最近的短视频
|
*
|
* @return
|
*/
|
public List<FunTVShortVideo2> getLatestShortVideo(int d) {
|
List<FunTVShortVideo2> shortVideo2List = new ArrayList<>();
|
// int pageSize = 100;
|
// long now = System.currentTimeMillis();
|
// int page = 1;
|
// int totalPage = -1;
|
// while (true) {
|
// Funtv2ResultVO result = FunTVNewApi.getVideos(page, pageSize, now - 1000 * 60 * 60L * 24 * d, now - 1000 * 60 * 60L * 24 * (d - 1), null, null);
|
// if (result != null) {
|
// for (Serializable a : result.getList()) {
|
// FunTVShortVideo2 video2 = (FunTVShortVideo2) a;
|
// shortVideo2List.add(video2);
|
// }
|
// }
|
// int count = result.getCount();
|
// if (totalPage < 0)
|
// totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
|
// if (page > totalPage)
|
// break;
|
// page++;
|
// }
|
return shortVideo2List;
|
}
|
|
}
|