From 8e2c06d3cf82be192505a02af654cdde9d4723a5 Mon Sep 17 00:00:00 2001
From: hejianhao <15708179461@qq.com>
Date: 星期四, 20 八月 2026 13:06:29 +0800
Subject: [PATCH] feat0806: 项目介绍密码功能
---
tcm-training-admin-backend/src/main/java/com/tcm/training/admin/live/service/LiveCourseAppService.java | 29 +++++++++++++++++++----------
1 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/tcm-training-admin-backend/src/main/java/com/tcm/training/admin/live/service/LiveCourseAppService.java b/tcm-training-admin-backend/src/main/java/com/tcm/training/admin/live/service/LiveCourseAppService.java
index ebd7eb0..c06dee9 100644
--- a/tcm-training-admin-backend/src/main/java/com/tcm/training/admin/live/service/LiveCourseAppService.java
+++ b/tcm-training-admin-backend/src/main/java/com/tcm/training/admin/live/service/LiveCourseAppService.java
@@ -35,23 +35,27 @@
public class LiveCourseAppService {
private static final int LIVE_ROOM_PASSWORD_TYPE = 1;
+ private static final int PROJECT_INTRODUCTION_PASSWORD_TYPE = 2;
private final LiveCourseMapper liveCourseMapper;
private final ExpertMapper expertMapper;
private final LiveSessionMapper liveSessionMapper;
private final LiveSessionQuestionMapper liveSessionQuestionMapper;
private final BCryptPasswordEncoder passwordEncoder;
+ private final ProjectIntroductionPasswordService projectIntroductionPasswordService;
public LiveCourseAppService(LiveCourseMapper liveCourseMapper,
ExpertMapper expertMapper,
LiveSessionMapper liveSessionMapper,
LiveSessionQuestionMapper liveSessionQuestionMapper,
- BCryptPasswordEncoder passwordEncoder) {
+ BCryptPasswordEncoder passwordEncoder,
+ ProjectIntroductionPasswordService projectIntroductionPasswordService) {
this.liveCourseMapper = liveCourseMapper;
this.expertMapper = expertMapper;
this.liveSessionMapper = liveSessionMapper;
this.liveSessionQuestionMapper = liveSessionQuestionMapper;
this.passwordEncoder = passwordEncoder;
+ this.projectIntroductionPasswordService = projectIntroductionPasswordService;
}
public PageResponse<LiveCourseListItemVO> page(int page, int pageSize, String keyword, Long expertId, Integer status, Integer liveStatus) {
@@ -186,17 +190,22 @@
}
public boolean verifyPassword(LiveCoursePasswordVerifyRequest req) {
- if (req.getType() != LIVE_ROOM_PASSWORD_TYPE) {
+ if (req.getType() == LIVE_ROOM_PASSWORD_TYPE) {
+ // 直播间密码验证
+ LiveCourse course = liveCourseMapper.selectOne(new LambdaQueryWrapper<LiveCourse>()
+ .isNotNull(LiveCourse::getPassword)
+ .orderByAsc(LiveCourse::getId)
+ .last("limit 1"));
+ return course != null
+ && course.getPassword() != null
+ && !course.getPassword().isEmpty()
+ && passwordEncoder.matches(req.getPassword(), course.getPassword());
+ } else if (req.getType() == PROJECT_INTRODUCTION_PASSWORD_TYPE) {
+ // 项目介绍密码验证
+ return projectIntroductionPasswordService.verifyPassword(req.getPassword());
+ } else {
throw new IllegalArgumentException("不支持的密码类型");
}
- LiveCourse course = liveCourseMapper.selectOne(new LambdaQueryWrapper<LiveCourse>()
- .isNotNull(LiveCourse::getPassword)
- .orderByAsc(LiveCourse::getId)
- .last("limit 1"));
- return course != null
- && course.getPassword() != null
- && !course.getPassword().isEmpty()
- && passwordEncoder.matches(req.getPassword(), course.getPassword());
}
@Transactional
--
Gitblit v1.7.1