This commit is contained in:
2025-07-28 22:36:30 +08:00
parent a96d9df7e6
commit a3bc9357b5
4 changed files with 40 additions and 8 deletions

View File

@@ -1,5 +1,8 @@
package com.ycwl.basic.repository;
import com.ycwl.basic.biz.PriceBiz;
import com.ycwl.basic.model.mobile.order.IsBuyBatchRespVO;
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
import com.ycwl.basic.utils.JacksonUtil;
import com.ycwl.basic.mapper.VideoMapper;
import com.ycwl.basic.model.pc.video.entity.MemberVideoEntity;
@@ -7,6 +10,7 @@ import com.ycwl.basic.model.pc.video.entity.VideoEntity;
import com.ycwl.basic.model.pc.video.resp.VideoRespVO;
import com.ycwl.basic.model.task.req.VideoInfoReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
@@ -22,6 +26,9 @@ public class VideoRepository {
public static final String VIDEO_CACHE_KEY = "video:%s";
public static final String VIDEO_BY_TASK_ID_CACHE_KEY = "video:task:%s";
@Autowired
@Lazy
private PriceBiz priceBiz;
public VideoEntity getVideo(Long videoId) {
if (redisTemplate.hasKey(String.format(VIDEO_CACHE_KEY, videoId))) {
@@ -86,7 +93,20 @@ public class VideoRepository {
if (memberVideo == null) {
return false;
}
return Integer.valueOf(1).equals(memberVideo.getIsBuy());
boolean isBuy = Integer.valueOf(1).equals(memberVideo.getIsBuy());
if (isBuy) {
return isBuy;
}
// 一口价
IsBuyBatchRespVO buy = priceBiz.isBuy(userId, memberVideo.getFaceId(), memberVideo.getScenicId(), -1, null);
if (buy == null) {
return false;
}
if (buy.isBuy()) {
return true;
}
return isBuy;
}
public boolean clearVideoCache(Long videoId) {