admin
2021-04-29 e404b19151ef1786aded572ed9bbaec4b5266e45
src/main/java/com/yeshi/buwan/service/imp/ad/DeviceAdStrategyServiceImpl.java
@@ -1,10 +1,13 @@
package com.yeshi.buwan.service.imp.ad;
import com.yeshi.buwan.dao.ad.DeviceAdStrategyDao;
import com.yeshi.buwan.domain.VideoInfo;
import com.yeshi.buwan.domain.ad.DeviceAdStrategy;
import com.yeshi.buwan.service.imp.VideoInfoService;
import com.yeshi.buwan.service.inter.ad.DeviceAdStrategyService;
import com.yeshi.buwan.service.inter.vip.VIPService;
import com.yeshi.buwan.util.StringUtil;
import com.yeshi.buwan.util.video.VideoConstant;
import com.yeshi.buwan.vo.video.VideoDetailVO;
import org.springframework.stereotype.Service;
@@ -19,6 +22,9 @@
    @Resource
    private VIPService vipService;
    @Resource
    private VideoInfoService videoInfoService;
    private DeviceAdStrategy init(String id, String deviceId, String detailSystemId) {
        DeviceAdStrategy strategy = new DeviceAdStrategy();
@@ -56,7 +62,23 @@
    }
    @Override
    public void setVideoDetailAdStrategy(String deviceId, String detailSystemId, long fsaExpireTime, long pvaExpireTime) {
    public VideoDetailVO.VideoAdInfo getVideoDetailAdStrategy(String deviceId, String detailSystemId, String loginUid, String videoId, String from) {
        VideoDetailVO.VideoAdInfo videoAdInfo = getVideoDetailAdStrategy(deviceId, detailSystemId, loginUid);
        //从APP首页推荐而来,并且有全屏視頻廣告
        if (videoAdInfo.isFullVideo() && "recommend".equalsIgnoreCase(from)) {
            //是否为4大分类
            VideoInfo videoInfo = videoInfoService.getVideoInfoCache(videoId);
            //除开四大分类外不展示全屏视频广告
            if (videoInfo != null && videoInfo.getContentType() != null && videoInfo.getContentType() != 1) {
                videoAdInfo.setFullVideo(false);
            }
        }
        return videoAdInfo;
    }
    @Override
    public void setVideoDetailAdStrategy(String deviceId, String detailSystemId, Long fsaExpireTime, Long pvaExpireTime) {
        if (StringUtil.isNullOrEmpty(deviceId) || StringUtil.isNullOrEmpty(detailSystemId)) {
            return;
        }
@@ -67,8 +89,10 @@
        }
        DeviceAdStrategy update = new DeviceAdStrategy();
        update.setId(id);
        update.setDetailFSAExpireTime(fsaExpireTime);
        update.setDetailPVAExpireTime(pvaExpireTime);
        if (fsaExpireTime != null)
            update.setDetailFSAExpireTime(fsaExpireTime);
        if (pvaExpireTime != null)
            update.setDetailPVAExpireTime(pvaExpireTime);
        deviceAdStrategyDao.updateSelective(update);
    }
}