前端大图展示逻辑
All checks were successful
Gitea/FrameTour-BE/pipeline/head This commit looks good

This commit is contained in:
2025-07-23 10:15:18 +08:00
parent 4d53986277
commit 1059d30c21
8 changed files with 54 additions and 1 deletions

View File

@@ -78,4 +78,13 @@ AppFaceController {
List<ContentPageVO> contentPageVOS = faceService.faceContentList(faceId); List<ContentPageVO> contentPageVOS = faceService.faceContentList(faceId);
return ApiResponse.success(contentPageVOS); return ApiResponse.success(contentPageVOS);
} }
@ApiOperation("绑定人脸")
@PostMapping("/{faceId}/bind")
public ApiResponse<String> bind(@PathVariable Long faceId) {
JwtInfo worker = JwtTokenUtil.getWorker();
Long userId = worker.getUserId();
faceService.bindFace(faceId, userId);
return ApiResponse.success("OK");
}
} }

View File

@@ -43,6 +43,7 @@ public class GoodsDetailVO {
private Integer isBuy; private Integer isBuy;
private Integer isFree; private Integer isFree;
private Integer parts; private Integer parts;
private Integer sort;
public Integer getSourceType() { public Integer getSourceType() {
return goodsType; return goodsType;
} }

View File

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

View File

@@ -36,4 +36,6 @@ public interface FaceService {
List<ContentPageVO> faceContentList(Long faceId); List<ContentPageVO> faceContentList(Long faceId);
ApiResponse<List<ContentPageVO>> contentListUseDefaultFace(); ApiResponse<List<ContentPageVO>> contentListUseDefaultFace();
void bindFace(Long faceId, Long userId);
} }

View File

@@ -21,4 +21,5 @@ public interface SourceService {
ApiResponse<Integer> update(SourceEntity source); ApiResponse<Integer> update(SourceEntity source);
ApiResponse cutVideo(Long id); ApiResponse cutVideo(Long id);
ApiResponse<String> uploadAndUpdateUrl(Long id, org.springframework.web.multipart.MultipartFile file);
} }

View File

@@ -381,6 +381,7 @@ public class FaceServiceImpl implements FaceService {
List<MemberVideoEntity> memberVideoEntityList = videoMapper.userFaceTemplateVideo(userId, faceId, contentPageVO.getTemplateId()); List<MemberVideoEntity> memberVideoEntityList = videoMapper.userFaceTemplateVideo(userId, faceId, contentPageVO.getTemplateId());
contentPageVO.setGoodsType(0); contentPageVO.setGoodsType(0);
contentPageVO.setContentType(1); contentPageVO.setContentType(1);
contentPageVO.setSort(contentPageVO.getSort());
if (!memberVideoEntityList.isEmpty()) { if (!memberVideoEntityList.isEmpty()) {
contentPageVO.setIsBuy(memberVideoEntityList.getFirst().getIsBuy()); contentPageVO.setIsBuy(memberVideoEntityList.getFirst().getIsBuy());
contentPageVO.setContentId(memberVideoEntityList.getFirst().getVideoId()); contentPageVO.setContentId(memberVideoEntityList.getFirst().getVideoId());
@@ -420,6 +421,8 @@ public class FaceServiceImpl implements FaceService {
ContentPageVO sourceImageContent = new ContentPageVO(); ContentPageVO sourceImageContent = new ContentPageVO();
sourceVideoContent.setName("录像集"); sourceVideoContent.setName("录像集");
sourceImageContent.setName("照片集"); sourceImageContent.setName("照片集");
sourceVideoContent.setSort(9999);
sourceImageContent.setSort(9999);
sourceVideoContent.setScenicId(faceRespVO.getScenicId()); sourceVideoContent.setScenicId(faceRespVO.getScenicId());
sourceImageContent.setScenicId(faceRespVO.getScenicId()); sourceImageContent.setScenicId(faceRespVO.getScenicId());
sourceVideoContent.setGoodsType(1); sourceVideoContent.setGoodsType(1);
@@ -489,5 +492,10 @@ public class FaceServiceImpl implements FaceService {
return ApiResponse.success(contentPageVOS); return ApiResponse.success(contentPageVOS);
} }
@Override
public void bindFace(Long faceId, Long userId) {
}
} }

View File

@@ -7,13 +7,17 @@ import com.ycwl.basic.model.pc.source.entity.SourceEntity;
import com.ycwl.basic.model.pc.source.req.SourceReqQuery; import com.ycwl.basic.model.pc.source.req.SourceReqQuery;
import com.ycwl.basic.model.pc.source.resp.SourceRespVO; import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
import com.ycwl.basic.repository.SourceRepository; import com.ycwl.basic.repository.SourceRepository;
import com.ycwl.basic.service.pc.ScenicService;
import com.ycwl.basic.service.pc.SourceService; import com.ycwl.basic.service.pc.SourceService;
import com.ycwl.basic.storage.adapters.IStorageAdapter;
import com.ycwl.basic.task.VideoPieceGetter; import com.ycwl.basic.task.VideoPieceGetter;
import com.ycwl.basic.utils.ApiResponse; import com.ycwl.basic.utils.ApiResponse;
import com.ycwl.basic.utils.SnowFlakeUtil; import com.ycwl.basic.utils.SnowFlakeUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import com.ycwl.basic.storage.StorageFactory;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
@@ -30,6 +34,8 @@ public class SourceServiceImpl implements SourceService {
private SourceMapper sourceMapper; private SourceMapper sourceMapper;
@Autowired @Autowired
private SourceRepository sourceRepository; private SourceRepository sourceRepository;
@Autowired
private ScenicService scenicService;
@Override @Override
public ApiResponse<PageInfo<SourceRespVO>> pageQuery(SourceReqQuery sourceReqQuery) { public ApiResponse<PageInfo<SourceRespVO>> pageQuery(SourceReqQuery sourceReqQuery) {
@@ -137,4 +143,29 @@ public class SourceServiceImpl implements SourceService {
} }
return ApiResponse.success("任务已下发"); return ApiResponse.success("任务已下发");
} }
@Override
public ApiResponse<String> uploadAndUpdateUrl(Long id, MultipartFile file) {
SourceRespVO source = sourceMapper.getById(id);
if (source == null) {
return ApiResponse.fail("该素材不存在");
}
try {
IStorageAdapter adapter = scenicService.getScenicStorageAdapter(source.getScenicId());
String uploadedUrl = adapter.uploadFile(file, "source", String.valueOf(id));
SourceEntity sourceUpd = new SourceEntity();
sourceUpd.setId(id);
sourceUpd.setUrl(uploadedUrl);
int updateResult = sourceMapper.update(sourceUpd);
if (updateResult > 0) {
return ApiResponse.success(uploadedUrl);
} else {
return ApiResponse.fail("更新URL失败");
}
} catch (Exception e) {
return ApiResponse.fail("文件上传失败: " + e.getMessage());
}
}
} }

View File

@@ -112,7 +112,7 @@
</select> </select>
<select id="listFor" resultType="com.ycwl.basic.model.mobile.scenic.content.ContentPageVO"> <select id="listFor" resultType="com.ycwl.basic.model.mobile.scenic.content.ContentPageVO">
select t.id templateId, t.scenic_id, s.name as scenic_name, t.`name`, pid, t.cover_url templateCoverUrl, select t.id templateId, t.scenic_id, s.name as scenic_name, t.`name`, pid, t.cover_url templateCoverUrl,
0 as sourceType, 0 as sourceType, sort,
t.create_time, t.price t.create_time, t.price
from template t left join scenic s on s.id = t.scenic_id from template t left join scenic s on s.id = t.scenic_id
where t.scenic_id = #{scenicId} and pid = 0 and t.status = 1 where t.scenic_id = #{scenicId} and pid = 0 and t.status = 1