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.FaceRepository;
|
||||
import com.ycwl.basic.repository.MemberRelationRepository;
|
||||
import com.ycwl.basic.repository.OrderRepository;
|
||||
import com.ycwl.basic.repository.ScenicRepository;
|
||||
import com.ycwl.basic.repository.TemplateRepository;
|
||||
import com.ycwl.basic.repository.VideoRepository;
|
||||
@@ -195,6 +196,8 @@ public class FaceServiceImpl implements FaceService {
|
||||
private PuzzleTemplateMapper puzzleTemplateMapper;
|
||||
@Autowired
|
||||
private FaceDetectLogAiCamService faceDetectLogAiCamService;
|
||||
@Autowired
|
||||
private OrderRepository orderRepository;
|
||||
|
||||
@Override
|
||||
public ApiResponse<PageInfo<FaceRespVO>> pageQuery(FaceReqQuery faceReqQuery) {
|
||||
@@ -444,7 +447,11 @@ public class FaceServiceImpl implements FaceService {
|
||||
contentPageVO.setContentType(1);
|
||||
contentPageVO.setSort(contentPageVO.getSort());
|
||||
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());
|
||||
VideoEntity video = videoRepository.getVideo(contentPageVO.getContentId());
|
||||
if (video != null) {
|
||||
@@ -474,9 +481,6 @@ public class FaceServiceImpl implements FaceService {
|
||||
}
|
||||
}
|
||||
boolean buy = orderBiz.checkUserBuyFaceItem(userId, faceId, contentPageVO.getGoodsType(), contentPageVO.getContentId());
|
||||
if (!buy) {
|
||||
buy = orderBiz.checkUserBuyFaceItem(userId, faceId, -1, contentPageVO.getTemplateId());
|
||||
}
|
||||
if (buy) {
|
||||
contentPageVO.setIsBuy(1);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user