免费数量

This commit is contained in:
2025-07-17 14:58:55 +08:00
parent af141161de
commit 64c4180e4d
4 changed files with 17 additions and 4 deletions

View File

@@ -68,6 +68,7 @@ public interface SourceMapper {
List<SourceEntity> listVideoByFaceRelation(Long memberId, Long faceId); List<SourceEntity> listVideoByFaceRelation(Long memberId, Long faceId);
List<SourceEntity> listImageByFaceRelation(Long memberId, Long faceId); List<SourceEntity> listImageByFaceRelation(Long memberId, Long faceId);
List<MemberSourceEntity> listByFaceRelation(Long memberId, Long faceId, Integer type);
SourceEntity getEntity(Long id); SourceEntity getEntity(Long id);

View File

@@ -34,4 +34,5 @@ public class ContentPageVO {
private Integer isBuy; private Integer isBuy;
private BigDecimal duration; private BigDecimal duration;
private Integer goodsType; private Integer goodsType;
private int freeCount;
} }

View File

@@ -418,12 +418,14 @@ public class FaceServiceImpl implements FaceService {
} else { } else {
sourceImageContent.setIsBuy(0); sourceImageContent.setIsBuy(0);
} }
List<SourceEntity> sourceEntities = sourceMapper.listImageByFaceRelation(faceRespVO.getMemberId(), faceId); List<MemberSourceEntity> relations = sourceMapper.listByFaceRelation(faceRespVO.getMemberId(), faceId, 2);
if (!sourceEntities.isEmpty()) { if (!relations.isEmpty()) {
sourceImageContent.setLockType(-1); sourceImageContent.setLockType(-1);
} else { } else {
sourceImageContent.setLockType(1); sourceImageContent.setLockType(1);
} }
long freeCount = relations.stream().filter(entity -> Integer.valueOf(1).equals(entity.getIsFree())).count();
sourceImageContent.setFreeCount((int) freeCount);
contentList.add(sourceImageContent); contentList.add(sourceImageContent);
} }
if (!Integer.valueOf(1).equals(scenicConfig.getDisableSourceVideo())) { if (!Integer.valueOf(1).equals(scenicConfig.getDisableSourceVideo())) {
@@ -435,12 +437,14 @@ public class FaceServiceImpl implements FaceService {
} else { } else {
sourceVideoContent.setIsBuy(0); sourceVideoContent.setIsBuy(0);
} }
List<SourceEntity> sourceEntities = sourceMapper.listVideoByFaceRelation(faceRespVO.getMemberId(), faceId); List<MemberSourceEntity> relations = sourceMapper.listByFaceRelation(faceRespVO.getMemberId(), faceId, 1);
if (!sourceEntities.isEmpty()) { if (!relations.isEmpty()) {
sourceVideoContent.setLockType(-1); sourceVideoContent.setLockType(-1);
} else { } else {
sourceVideoContent.setLockType(1); sourceVideoContent.setLockType(1);
} }
long freeCount = relations.stream().filter(entity -> Integer.valueOf(1).equals(entity.getIsFree())).count();
sourceVideoContent.setFreeCount((int) freeCount);
contentList.add(sourceVideoContent); contentList.add(sourceVideoContent);
} }
sourceList.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).forEach((type, list) -> { sourceList.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).forEach((type, list) -> {

View File

@@ -227,4 +227,11 @@
<if test="type!=null">and ms.type = #{type} </if> <if test="type!=null">and ms.type = #{type} </if>
<if test="faceId!=null">and ms.face_id = #{faceId} </if> <if test="faceId!=null">and ms.face_id = #{faceId} </if>
</select> </select>
<select id="listByFaceRelation" resultType="com.ycwl.basic.model.pc.source.entity.MemberSourceEntity">
select *
from member_source ms
where ms.member_id = #{memberId}
and ms.face_id = #{faceId}
<if test="type!=null">and ms.type = #{type} </if>
</select>
</mapper> </mapper>