hejianhao
2026-09-01 540ef65220e05b75c183cd3554aaeb554927600a
tcm-training-admin-backend/src/main/java/com/tcm/training/admin/app/home/controller/AppHomeLiveCourseController.java
@@ -3,11 +3,17 @@
import com.tcm.training.admin.app.home.service.AppHomeLiveCourseService;
import com.tcm.training.admin.app.home.vo.AppHomeLiveCourseVO;
import com.tcm.training.admin.common.ApiResponse;
import com.tcm.training.admin.live.dto.LiveCoursePasswordVerifyRequest;
import com.tcm.training.admin.live.service.LiveCourseAppService;
import com.tcm.training.admin.live.service.ProjectIntroductionPasswordService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.List;
/**
@@ -20,11 +26,19 @@
    private final AppHomeLiveCourseService appHomeLiveCourseService;
    private final LiveCourseAppService liveCourseAppService;
    private final ProjectIntroductionPasswordService projectIntroductionPasswordService;
    /**
     * 注入首页养生直播服务。
     */
    public AppHomeLiveCourseController(AppHomeLiveCourseService appHomeLiveCourseService) {
    public AppHomeLiveCourseController(AppHomeLiveCourseService appHomeLiveCourseService,
                                       LiveCourseAppService liveCourseAppService,
                                       ProjectIntroductionPasswordService projectIntroductionPasswordService) {
        this.appHomeLiveCourseService = appHomeLiveCourseService;
        this.liveCourseAppService = liveCourseAppService;
        this.projectIntroductionPasswordService = projectIntroductionPasswordService;
    }
    /**
@@ -34,4 +48,20 @@
    public ApiResponse<List<AppHomeLiveCourseVO>> listHomeLiveCourses() {
        return ApiResponse.ok(appHomeLiveCourseService.listHomeLiveCourses());
    }
    /**
     * 校验 APP 首页直播课程访问密码。
     */
    @PostMapping("/live-courses/password/verify")
    public ApiResponse<Boolean> verifyPassword(@Valid @RequestBody LiveCoursePasswordVerifyRequest req) {
        return ApiResponse.ok(liveCourseAppService.verifyPassword(req));
    }
    /**
     * 检查项目介绍是否启用密码访问。
     */
    @GetMapping("/project-introduction/password-enabled")
    public ApiResponse<Boolean> isProjectIntroductionPasswordEnabled() {
        return ApiResponse.ok(projectIntroductionPasswordService.isPasswordEnabled());
    }
}