Template
31 lines
922 B
Java
31 lines
922 B
Java
package com.music.controller;
|
|
|
|
import com.music.common.Result;
|
|
import com.music.dto.DependencyStatus;
|
|
import com.music.service.RuntimeDependencyService;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
@RestController
|
|
public class HealthController {
|
|
|
|
private final RuntimeDependencyService dependencyService;
|
|
|
|
public HealthController(RuntimeDependencyService dependencyService) {
|
|
this.dependencyService = dependencyService;
|
|
}
|
|
|
|
@GetMapping("/api/health")
|
|
public Result<String> health() {
|
|
return Result.success("OK");
|
|
}
|
|
|
|
/**
|
|
* 运行时依赖检查:报告 ffmpeg / ffprobe 是否可用及版本,便于部署自检与排障。
|
|
*/
|
|
@GetMapping("/api/health/dependencies")
|
|
public Result<DependencyStatus> dependencies() {
|
|
return Result.success(dependencyService.check());
|
|
}
|
|
}
|