admin
2021-03-20 ad3ac53da1c3a11a96ae62d790aa61a81b9eab91
src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java
@@ -12,6 +12,7 @@
import com.yeshi.buwan.domain.*;
import com.yeshi.buwan.domain.jump.JumpDetail;
import com.yeshi.buwan.domain.jump.JumpTypeEnum;
import com.yeshi.buwan.domain.recommend.HomeRecommendSpecial;
import com.yeshi.buwan.domain.system.DetailSystemConfig;
import com.yeshi.buwan.domain.system.DetailSystem;
import com.yeshi.buwan.domain.video.VideoWatchHistory;
@@ -19,6 +20,7 @@
import com.yeshi.buwan.pptv.entity.PPTVSeries;
import com.yeshi.buwan.service.imp.*;
import com.yeshi.buwan.service.inter.juhe.PPTVService;
import com.yeshi.buwan.service.inter.recommend.HomeRecommendSpecialService;
import com.yeshi.buwan.service.inter.video.VideoWatchHistoryService;
import com.yeshi.buwan.util.*;
import com.yeshi.buwan.util.annotation.RequireUid;
@@ -83,17 +85,23 @@
    @Resource
    private VideoWatchHistoryService videoWatchHistoryService;
    @Resource
    private HomeRecommendSpecialService homeRecommendSpecialService;
    private final Logger userPlayLogger = LoggerFactory.getLogger("videoPlayUser");
    @RequireUid
    public void getHomeAd(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
        String vtid = request.getParameter("Vtid");
        if (!"310".equals(vtid)) {
        HomeRecommendSpecial special = homeRecommendSpecialService.getSpecial(vtid);
        //兼容新版本
        if (special != null) {
            JSONObject object = new JSONObject();
            DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
            List<HomeAd> list = homeAdService.getHomeAdList(detailSystem);
            List<HomeAd> list = homeAdService.getHomeAdList(detailSystem, special != null ? special.getDataKey() : null);
            if (acceptData.getPlatform().equalsIgnoreCase("ios"))// IOS测试
            {
@@ -119,7 +127,6 @@
                for (int i = 0; i < list.size(); i++)
                    array.add(StringUtil.outPutResultJson(list.get(i)));
                object.put("data", array);
            } else {
                for (HomeAd ad : list) {
                    if (ad.getVideo() != null) {
@@ -137,6 +144,7 @@
                object.put("data", array);
            }
            object.put("bannerSizeRate", special.getBannerSizeRate());
            out.print(JsonUtil.loadTrueJson(object.toString()));
        } else {
            classParser.getRecommendCategoryVideoBanner(acceptData, request, out);
@@ -156,12 +164,14 @@
            vtid = "309"; // 为了兼容以前的推荐
        }
        HomeRecommendSpecial special = homeRecommendSpecialService.getSpecial(vtid);
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        JSONObject object = new JSONObject();
        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion());
        List<HomeType> list1 = homeTypeService.getHomeType(detailSystem.getId(), resourceList,
                CacheUtil.getMD5Long(resourceList), -1, Long.parseLong(vtid));
                CacheUtil.getMD5Long(resourceList), -1, special != null ? special.getDataKey() : null);
        List<HomeType> list = new ArrayList<>();
        for (HomeType ht : list1)
            list.add(ht);
@@ -201,7 +211,7 @@
                    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()) {
                        if (adP < list.size() && adP > -1) {
                            HomeType homeType = new HomeType();
                            homeType.setAd(ad);
                            list.add(adP, homeType);