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

@@ -152,6 +152,9 @@ public class OrderBiz {
if (!isBuy) {
if (goodsType == 0) {
VideoEntity video = videoRepository.getVideo(goodsId);
if (video == null) {
return respVO;
}
TaskEntity task = videoTaskRepository.getTaskById(video.getTaskId());
Long templateId = video.getTemplateId();
// -1为整个模板购买

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) {

View File

@@ -269,6 +269,8 @@ public class GoodsServiceImpl implements GoodsService {
goodsDetailVO.setFaceId(entity.getFaceId());
goodsDetailVO.setIsBuy(entity.getIsBuy());
if (Integer.valueOf(0).equals(entity.getIsBuy())) {
IsBuyRespVO buy = orderBiz.isBuy(userId, videoRespVO.getScenicId(), 0, videoId);
if (!buy.isBuy()) {
PriceObj priceObj = orderBiz.queryPrice(videoRespVO.getScenicId(), 0, videoId);
if (priceObj.isFree()) {
goodsDetailVO.setIsBuy(1);
@@ -278,6 +280,9 @@ public class GoodsServiceImpl implements GoodsService {
goodsDetailVO.setOrigPrice(priceObj.getPrice());
goodsDetailVO.setSlashPrice(priceObj.getSlashPrice());
}
} else {
goodsDetailVO.setIsBuy(1);
}
}
}
}

View File

@@ -413,6 +413,10 @@ public class FaceServiceImpl implements FaceService {
contentPageVO.setLockType(1);
}
}
IsBuyRespVO buy = orderBiz.isBuy(userId, contentPageVO.getScenicId(), contentPageVO.getGoodsType(), contentPageVO.getContentId());
if (buy.isBuy()) {
contentPageVO.setIsBuy(1);
}
});
SourceReqQuery sourceReqQuery = new SourceReqQuery();