admin
2021-02-01 c6c5a8ce0f42d46ea2fe0312c9eda67a49fd3917
src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java
@@ -9,6 +9,7 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.yeshi.buwan.domain.*;
import com.yeshi.buwan.util.annotation.RequireUid;
import com.yeshi.buwan.vo.AcceptData;
import org.apache.commons.httpclient.HttpClient;
@@ -16,16 +17,6 @@
import org.apache.commons.httpclient.methods.GetMethod;
import org.springframework.stereotype.Controller;
import com.yeshi.buwan.domain.Config;
import com.yeshi.buwan.domain.DetailSystem;
import com.yeshi.buwan.domain.HomeAd;
import com.yeshi.buwan.domain.HomeType;
import com.yeshi.buwan.domain.HomeVideo;
import com.yeshi.buwan.domain.RecommendAd;
import com.yeshi.buwan.domain.UserInfo;
import com.yeshi.buwan.domain.VideoDetailInfo;
import com.yeshi.buwan.domain.VideoInfo;
import com.yeshi.buwan.domain.VideoType;
import com.yeshi.buwan.domain.entity.PlayUrl;
import com.yeshi.buwan.service.imp.AdService;
import com.yeshi.buwan.service.imp.AttentionService;
@@ -86,6 +77,9 @@
    @Resource
    private ClassParser classParser;
    @Resource
    private VideoDetailUtil videoDetailUtil;
    @RequireUid
    public void getHomeAd(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
        String vtid = request.getParameter("Vtid");
@@ -95,28 +89,6 @@
            DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
            List<HomeAd> list = homeAdService.getHomeAdList(detailSystem);
            // 测试跳转小程序
            // JSONObject xcx = new JSONObject();
            // xcx.put("thumb",
            // "http://img.zcool.cn/community/0169235af03daea801206aba8664d7.jpeg@260w_195h_1c_1e_1o_100sh.jpg");
            // xcx.put("title", "测试标题");
            // xcx.put("desc", "简介");
            // xcx.put("path", "pages/index/index");
            // xcx.put("username", "gh_33b9bea57aff");
            // xcx.put("url", "http://video.yeshitv.com");
            // 测试标题
            // HomeAd homeAd = new HomeAd();
            // homeAd.setClazz("com");
            // homeAd.setLinkType(5);
            // homeAd.setOrderby(0);
            // homeAd.setPicture(
            // "http://img.zcool.cn/community/0169235af03daea801206aba8664d7.jpeg@260w_195h_1c_1e_1o_100sh.jpg");
            // homeAd.setVideo(new VideoInfo(1 + ""));
            // homeAd.setParams(xcx.toString());
            // homeAd.setTitle("标题");
            // list.add(homeAd);
            if (acceptData.getPlatform().equalsIgnoreCase("ios"))// IOS测试
            {
@@ -172,7 +144,6 @@
        } else {
            classParser.getRecommendCategoryVideoBanner(acceptData, request, out);
        }
    }
    // 首页类型获取
@@ -366,9 +337,11 @@
            return;
        }
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getPlatform(), acceptData.getVersion());
        VideoInfo info = (videoDeailUtil.getVideoInfo(videoId, resourceId, resourceList,
        VideoInfo info = (videoDeailUtil.getVideoInfo(detailSystem.getId(), videoId, resourceId, resourceList,
                CacheUtil.getMD5Long(resourceList)));
        List<VideoType> typeList = classService.getVideoTypeList(info.getId());
@@ -391,7 +364,7 @@
        // version));
        // 过滤版权视频关键字
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        // 统计添加
        // statisticsService.addStatistics(detailSystem.getId(), videoId);
@@ -431,6 +404,46 @@
            out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(Utils.convertVideo(info)), array.toString(),
                    obj.toString()));
    }
    /**
     * 获取视频的剧集列表
     *
     * @param acceptData
     * @param request
     * @param out
     */
    @RequireUid
    public void getVideoEpisodeList(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
        String videoId = request.getParameter("VideoId");
        String resourceId = request.getParameter("ResourceId");
        String page = request.getParameter("Page");//页码
        if (StringUtil.isNullOrEmpty(videoId)) {
            out.print(JsonUtil.loadFalseJson("请上传VideoId"));
            return;
        }
        if (StringUtil.isNullOrEmpty(resourceId)) {
            out.print(JsonUtil.loadFalseJson("请上传ResourceId"));
            return;
        }
        if (StringUtil.isNullOrEmpty(page)) {
            out.print(JsonUtil.loadFalseJson("请上传Page"));
            return;
        }
        List<VideoDetailInfo> list = videoDetailUtil.getVideoDetailList(videoId, new VideoResource(resourceId), Integer.parseInt(page), 100);
        if (list == null)
            list = new ArrayList<>();
        JSONObject data = new JSONObject();
        String listStr = StringUtil.outPutResultJson(list);
        boolean hasMore = list != null && list.size() > 0;
        data.put("list", listStr);
        data.put("hasMore", hasMore);
        out.print(JsonUtil.loadTrueJson(data.toString()));
    }
    @RequireUid
    public void getNewVideoDetail(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
@@ -481,7 +494,7 @@
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        PlayUrl pu = videoDeailUtil.getPlayUrl(detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId);
        PlayUrl pu = videoDeailUtil.getPlayUrl(acceptData, detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId);
        if (pu != null) {
            if (!StringUtil.isNullOrEmpty(pu.getUrl()))
@@ -494,6 +507,7 @@
    }
    public List<HomeVideo> getZhiBoVideoList() throws Exception {
        List<HomeVideo> list = new ArrayList<HomeVideo>();
        String result = get("http://www.kktv1.com/CDN/output/M/3/I/10002002/P/start-0_offset-6_platform-2/json.js");