admin
2024-10-17 b30fb8afd3cd6228bda9b182dc412bb3c8daf69c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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;
    }
 
}