From f537abe9f3646c739beaf15076246a2f71a347e9 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 20 二月 2025 16:57:55 +0800
Subject: [PATCH] IOS广告增加区域屏蔽

---
 src/main/java/com/yeshi/buwan/service/imp/juhe/FunTV2ServiceImpl.java |  116 ++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 77 insertions(+), 39 deletions(-)

diff --git a/src/main/java/com/yeshi/buwan/service/imp/juhe/FunTV2ServiceImpl.java b/src/main/java/com/yeshi/buwan/service/imp/juhe/FunTV2ServiceImpl.java
index acc2d64..6af9446 100644
--- a/src/main/java/com/yeshi/buwan/service/imp/juhe/FunTV2ServiceImpl.java
+++ b/src/main/java/com/yeshi/buwan/service/imp/juhe/FunTV2ServiceImpl.java
@@ -6,31 +6,32 @@
 import com.yeshi.buwan.dao.juhe.funtv.FunTVVideo2Dao;
 import com.yeshi.buwan.dao.juhe.funtv.VideoFunTV2Dao;
 import com.yeshi.buwan.dao.video.AlbumVideoMapDao;
-import com.yeshi.buwan.domain.ResourceVideo;
 import com.yeshi.buwan.domain.VideoDetailInfo;
 import com.yeshi.buwan.domain.VideoInfo;
 import com.yeshi.buwan.domain.VideoResource;
 import com.yeshi.buwan.domain.entity.PlayUrl;
+import com.yeshi.buwan.domain.system.DetailSystemConfig;
 import com.yeshi.buwan.domain.video.AlbumVideoMap;
-import com.yeshi.buwan.funtv.FunTVUtil2;
-import com.yeshi.buwan.funtv.entity.FunTVAlbum2;
-import com.yeshi.buwan.funtv.entity.FunTVShortVideo2;
-import com.yeshi.buwan.funtv.entity.FunTVVideo2;
-import com.yeshi.buwan.funtv.entity.VideoFunTV2;
-import com.yeshi.buwan.service.imp.CategoryVideoService;
-import com.yeshi.buwan.service.imp.ResourceVideoService;
-import com.yeshi.buwan.service.imp.VideoInfoService;
-import com.yeshi.buwan.service.imp.VideoResourceService;
+import com.yeshi.buwan.service.imp.*;
 import com.yeshi.buwan.service.inter.juhe.FunTV2Service;
-import com.yeshi.buwan.util.mq.CMQManager;
+import com.yeshi.buwan.util.StringUtil;
+import com.yeshi.buwan.util.mq.rabbit.RabbitmqManager;
 import com.yeshi.buwan.util.video.VideoConstant;
+import com.yeshi.buwan.videos.funtv.FunTVUtil2;
+import com.yeshi.buwan.videos.funtv.entity.FunTVAlbum2;
+import com.yeshi.buwan.videos.funtv.entity.FunTVShortVideo2;
+import com.yeshi.buwan.videos.funtv.entity.FunTVVideo2;
+import com.yeshi.buwan.videos.funtv.entity.VideoFunTV2;
 import com.yeshi.buwan.vo.AcceptData;
+import net.sf.json.JSONObject;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.io.Serializable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
 
 @Service
 public class FunTV2ServiceImpl implements FunTV2Service {
@@ -64,6 +65,12 @@
 
     @Resource
     private VideoResourceService videoResourceService;
+
+    @Resource
+    private DetailSystemConfigService detailSystemConfigService;
+
+    @Resource
+    private RabbitmqManager rabbitmqManager;
 
 
     @Override
@@ -103,14 +110,14 @@
                 videoInfo.setVpicture(newVideoInfo.getVpicture());
                 videoInfo.setShow(newVideoInfo.getShow());
                 videoInfo.setVideoType(newVideoInfo.getVideoType());
-                videoInfoDao.update(videoInfo);
+                videoInfoService.update(videoInfo);
             }
         } else {//瑙嗛涓嶅瓨鍦�
             //鍒ゆ柇2涓棰戝疄浣撴槸鍚︿负鍚屼竴瑙嗛
-            VideoInfo oldVideo = videoInfoService.getExistSameVideo(newVideoInfo);
+            VideoInfo oldVideo = videoInfoService.getExistSameVideoWithTime(newVideoInfo);
             if (oldVideo == null) {
                 //娣诲姞瑙嗛
-                Serializable id = videoInfoDao.save(newVideoInfo);
+                Serializable id = videoInfoService.save(newVideoInfo);
                 newVideoInfo.setId(id + "");
             } else {//涓哄悓涓�瑙嗛
                 //鏇存柊tag
@@ -122,11 +129,12 @@
                 oldVideo.setVpicture(newVideoInfo.getVpicture());
                 oldVideo.setShow(newVideoInfo.getShow());
                 oldVideo.setVideoType(newVideoInfo.getVideoType());
-                videoInfoDao.update(oldVideo);
+                videoInfoService.update(oldVideo);
             }
 
             //鍔犲叆涓撹緫瑙嗛鏄犲皠
             AlbumVideoMap map = new AlbumVideoMap();
+            map.setId(newVideoInfo.getId());
             map.setCreateTime(new Date());
             map.setVideoId(newVideoInfo.getId());
             map.setRootVideoType(newVideoInfo.getVideoType().getId());
@@ -144,7 +152,7 @@
         resourceVideoService.addVideoResource(newVideoInfo.getId(), FunTVUtil2.RESOURCE_ID + "");
         //娣诲姞瑙嗛鍒嗙被鏄犲皠
         categoryVideoService.addCategoryVideo(newVideoInfo.getId(), newVideoInfo.getVideoType().getId());
-        CMQManager.getInstance().addSolrMsg(newVideoInfo.getId());
+        rabbitmqManager.addSolrMsg(newVideoInfo.getId());
     }
 
     @Override
@@ -216,18 +224,65 @@
             return 1;
     }
 
+    private int getPlayType(AcceptData acceptData, FunTVVideo2 video2) {
+        //濡傛灉鏄鍦ㄤ笂绾跨殑鐗堟湰灏辩敤SDK鎾斁锛屽惁鍒欓噰鐢℉5
+
+        DetailSystemConfig config = detailSystemConfigService.getConfigByKey("funshion_sdk_player", acceptData.getDetailSystem(), acceptData.getVersion());
+        //榛樿SDK鎾斁
+        if (config == null)
+            return FunTVUtil2.PLAY_HTML;
+
+        String channel = acceptData.getChannel();
+        if (StringUtil.isNullOrEmpty(channel)) {
+            channel = "qq";
+        }
+        channel = channel.toLowerCase().trim();
+        JSONObject data = JSONObject.fromObject(config.getValue());
+        JSONObject channelJSON = data.optJSONObject(channel);
+        //娓犻亾涓嶅瓨鍦ㄥ氨褰撳仛QQ娓犻亾鍋氬鐞�
+        if (channelJSON == null)
+            channelJSON = data.optJSONObject("qq");
+        if (channelJSON == null)
+            return FunTVUtil2.PLAY_SDK;
+
+
+        int version = channelJSON.optInt("version");
+        if (acceptData.getVersion() < version) {
+            //鍙栬瀹氬��
+            String type = channelJSON.optString("type");
+            if ("html".equalsIgnoreCase(type)) {
+                return FunTVUtil2.PLAY_HTML;
+            } else if ("sdk".equalsIgnoreCase(type)) {
+                return FunTVUtil2.PLAY_SDK;
+            } else {
+                return FunTVUtil2.PLAY_NONE;
+            }
+        } else {
+            //鍙栬瀹氱浉鍙嶅��
+            String type = channelJSON.optString("type");
+            if ("html".equalsIgnoreCase(type)) {
+                return FunTVUtil2.PLAY_SDK;
+            } else if ("sdk".equalsIgnoreCase(type)) {
+                return FunTVUtil2.PLAY_HTML;
+            } else {
+                return FunTVUtil2.PLAY_NONE;
+            }
+        }
+    }
+
+
     @Override
     public PlayUrl getPlayUrl(AcceptData acceptData, String detailSystemId, int resourceId, String id, String videoId) {
         FunTVVideo2 video2 = funTVVideo2Dao.get(id);
         VideoResource vr = videoResourceService.getResource(resourceId + "");
-        int t = FunTVUtil2.getPlayType(acceptData,video2);
+        int t = getPlayType(acceptData, video2);
         PlayUrl pu = new PlayUrl();
         pu.setParams("");
-        pu.setPlayType(t);
+        pu.setPlayType(1);
         pu.setResource(vr);
         pu.setAid(video2.getMediaId());
         pu.setVid(video2.getId());
-
+        pu.setCode(video2.getCeCode());
         if (t == FunTVUtil2.PLAY_NONE) {
             pu.setUrl("");
         } else {
@@ -257,25 +312,8 @@
         VideoFunTV2 videoFunTV2 = videoFunTV2Dao.selectByMediaId(mediaId);
         if (videoFunTV2 == null)
             return;
-
-        List<ResourceVideo> resourceVideoList = resourceVideoService.getResourceList(videoFunTV2.getVideoId() + "");
-        for (int i = 0; i < resourceVideoList.size(); i++) {
-            ResourceVideo rv = resourceVideoList.get(i);
-            if (rv.getResource() != null && Integer.parseInt(rv.getResource().getId()) == FunTVUtil2.RESOURCE_ID) {
-                //鍒犻櫎璧勬簮鏄犲皠
-                resourceVideoService.delete(rv);
-                resourceVideoList.remove(i);
-                i--;
-            }
-        }
-
-        if (resourceVideoList.size() == 0) {
-            //闅愯棌瑙嗛
-            videoInfoService.hiddenVideo(videoFunTV2.getVideoId() + "");
-            //鏇存柊鎼滅储寮曟搸
-            CMQManager.getInstance().addSolrMsg(videoFunTV2.getVideoId() + "");
-        }
-
+        videoFunTV2Dao.deleteByVideoId(videoFunTV2.getVideoId());
+        resourceVideoService.delete(videoFunTV2.getVideoId() + "", FunTVUtil2.RESOURCE_ID + "");
         //鍒犻櫎濯掍綋涓庡獟浣撳搴旂殑瑙嗛
         funTVAlbum2Dao.delete(mediaId);
         List<FunTVVideo2> video2List = listAllEpisodeList(mediaId);

--
Gitblit v1.8.0