You've already forked FrameTour-BE
feat(face): 优化人脸内容购买逻辑
- 引入OrderRepository依赖以查询用户购买状态 - 修改内容购买检查逻辑,优先检查人脸项目购买情况 - 添加模板购买状态的二次校验机制 - 移除冗余的订单业务层调用逻辑 - 简化购买状态判断流程,提高代码可读性
This commit is contained in:
@@ -56,6 +56,7 @@ import com.ycwl.basic.puzzle.mapper.PuzzleTemplateMapper;
|
|||||||
import com.ycwl.basic.repository.DeviceRepository;
|
import com.ycwl.basic.repository.DeviceRepository;
|
||||||
import com.ycwl.basic.repository.FaceRepository;
|
import com.ycwl.basic.repository.FaceRepository;
|
||||||
import com.ycwl.basic.repository.MemberRelationRepository;
|
import com.ycwl.basic.repository.MemberRelationRepository;
|
||||||
|
import com.ycwl.basic.repository.OrderRepository;
|
||||||
import com.ycwl.basic.repository.ScenicRepository;
|
import com.ycwl.basic.repository.ScenicRepository;
|
||||||
import com.ycwl.basic.repository.TemplateRepository;
|
import com.ycwl.basic.repository.TemplateRepository;
|
||||||
import com.ycwl.basic.repository.VideoRepository;
|
import com.ycwl.basic.repository.VideoRepository;
|
||||||
@@ -195,6 +196,8 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
private PuzzleTemplateMapper puzzleTemplateMapper;
|
private PuzzleTemplateMapper puzzleTemplateMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private FaceDetectLogAiCamService faceDetectLogAiCamService;
|
private FaceDetectLogAiCamService faceDetectLogAiCamService;
|
||||||
|
@Autowired
|
||||||
|
private OrderRepository orderRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResponse<PageInfo<FaceRespVO>> pageQuery(FaceReqQuery faceReqQuery) {
|
public ApiResponse<PageInfo<FaceRespVO>> pageQuery(FaceReqQuery faceReqQuery) {
|
||||||
@@ -444,7 +447,11 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
contentPageVO.setContentType(1);
|
contentPageVO.setContentType(1);
|
||||||
contentPageVO.setSort(contentPageVO.getSort());
|
contentPageVO.setSort(contentPageVO.getSort());
|
||||||
if (!memberVideoEntityList.isEmpty()) {
|
if (!memberVideoEntityList.isEmpty()) {
|
||||||
contentPageVO.setIsBuy(memberVideoEntityList.getFirst().getIsBuy());
|
boolean isBuy = orderRepository.checkUserBuyFaceItem(userId, faceId, 0, contentPageVO.getContentId());
|
||||||
|
if (!isBuy) {
|
||||||
|
isBuy = orderRepository.checkUserBuyFaceItem(userId, faceId, -1, contentPageVO.getTemplateId()); // 购买模板
|
||||||
|
}
|
||||||
|
contentPageVO.setIsBuy(isBuy ? 1 : 0);
|
||||||
contentPageVO.setContentId(memberVideoEntityList.getFirst().getVideoId());
|
contentPageVO.setContentId(memberVideoEntityList.getFirst().getVideoId());
|
||||||
VideoEntity video = videoRepository.getVideo(contentPageVO.getContentId());
|
VideoEntity video = videoRepository.getVideo(contentPageVO.getContentId());
|
||||||
if (video != null) {
|
if (video != null) {
|
||||||
@@ -474,9 +481,6 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean buy = orderBiz.checkUserBuyFaceItem(userId, faceId, contentPageVO.getGoodsType(), contentPageVO.getContentId());
|
boolean buy = orderBiz.checkUserBuyFaceItem(userId, faceId, contentPageVO.getGoodsType(), contentPageVO.getContentId());
|
||||||
if (!buy) {
|
|
||||||
buy = orderBiz.checkUserBuyFaceItem(userId, faceId, -1, contentPageVO.getTemplateId());
|
|
||||||
}
|
|
||||||
if (buy) {
|
if (buy) {
|
||||||
contentPageVO.setIsBuy(1);
|
contentPageVO.setIsBuy(1);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user