admin
2021-03-18 b37275dba6b782bf3bb3817c4504f6cdef1bef7c
src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java
@@ -2,12 +2,16 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.google.gson.Gson;
import com.yeshi.buwan.domain.*;
import com.yeshi.buwan.domain.jump.JumpDetail;
import com.yeshi.buwan.domain.jump.JumpTypeEnum;
import com.yeshi.buwan.domain.system.DetailSystemConfig;
import com.yeshi.buwan.domain.system.DetailSystem;
import com.yeshi.buwan.domain.video.VideoWatchHistory;
@@ -79,7 +83,7 @@
    @Resource
    private VideoWatchHistoryService videoWatchHistoryService;
    private final Logger playLogger = LoggerFactory.getLogger("videoPlay");
    private final Logger userPlayLogger = LoggerFactory.getLogger("videoPlayUser");
    @RequireUid
    public void getHomeAd(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
@@ -190,6 +194,20 @@
                        e.printStackTrace();
                    }
                }
                if (VersionUtil.isGraterThan387(acceptData.getPlatform(), acceptData.getVersion())) {
                    DetailSystemConfig adContent = configService.getConfigByKey("home_banner_ad_content", acceptData.getDetailSystem(), acceptData.getVersion());
                    DetailSystemConfig adPosition = configService.getConfigByKey("home_banner_ad_position", acceptData.getDetailSystem(), acceptData.getVersion());
                    if (adContent != null && adPosition != null) {
                        HomeType.HomeTypeAd ad = new Gson().fromJson(adContent.getValue(), HomeType.HomeTypeAd.class);
                        int adP = Integer.parseInt(adPosition.getValue());
                        if (adP < list.size()) {
                            HomeType homeType = new HomeType();
                            homeType.setAd(ad);
                            list.add(adP, homeType);
                        }
                    }
                }
            }
            if (acceptData.getPlatform().equalsIgnoreCase("ios")) {
@@ -222,13 +240,14 @@
        JSONArray array = new JSONArray();
        for (HomeType ht : list) {
            for (int i = 0; i < ht.getHomeVideoList().size(); i++) {
                //改变图片
                if (JuheVideoUtil.isNeedDelete(ht.getHomeVideoList().get(i).getVideo(), detailSystem.getId())) {
                    ht.getHomeVideoList().remove(i);
                    i--;
            if (ht.getHomeVideoList() != null)
                for (int i = 0; i < ht.getHomeVideoList().size(); i++) {
                    //改变图片
                    if (JuheVideoUtil.isNeedDelete(ht.getHomeVideoList().get(i).getVideo(), detailSystem.getId())) {
                        ht.getHomeVideoList().remove(i);
                        i--;
                    }
                }
            }
        }
        for (int i = 0; i < list.size(); i++)
@@ -236,7 +255,6 @@
        object.put("data", array);
        out.print(JsonUtil.loadTrueJson(object.toString()));
    }
    public HomeType convertHomeVideoList(HomeType type) {
@@ -365,7 +383,7 @@
            }
        });
        playLogger.info(VideoLogFactory.createUserVideoDetailLog(acceptData.getDevice(), loginUid, acceptData.getDetailSystem().getId(), videoId, resourceId, from));
        userPlayLogger.info(VideoLogFactory.createUserVideoDetailLog(acceptData.getDevice(), acceptData.getUtdId(), loginUid, acceptData.getDetailSystem().getId(), videoId, resourceId, from));
        //PPTV网页播放
@@ -388,6 +406,7 @@
            String playUrl = PPTVUtil.getPlayUrl(series, series.getSeries().get(p));
            data.put("videoId", videoId);
            data.put("playUrl", playUrl);
            data.put("name", series.getName());
            data.put("pptv", true);
            out.print(JsonUtil.loadTrueJson(data.toString()));
            return;