43 lines
1.2 KiB
Java
43 lines
1.2 KiB
Java
package com.test.musichouduan.controller;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* 简单的Hello控制器
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/api")
|
|
public class HelloController {
|
|
|
|
/**
|
|
* 欢迎接口
|
|
*/
|
|
@GetMapping("/hello")
|
|
public Map<String, Object> hello() {
|
|
Map<String, Object> result = new HashMap<>();
|
|
result.put("code", 200);
|
|
result.put("message", "Hello, Music API!");
|
|
result.put("data", "欢迎使用音乐应用API");
|
|
result.put("timestamp", System.currentTimeMillis());
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* 测试热部署接口
|
|
*/
|
|
@GetMapping("/test")
|
|
public Map<String, Object> test() {
|
|
Map<String, Object> result = new HashMap<>();
|
|
result.put("code", 200);
|
|
result.put("message", "测试成功");
|
|
result.put("data", "这是一个测试接口,可以修改此处来测试热部署");
|
|
result.put("timestamp", System.currentTimeMillis());
|
|
return result;
|
|
}
|
|
}
|