统一axios写法
This commit is contained in:
@@ -8,6 +8,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
@@ -25,11 +26,11 @@ public class SseController {
|
||||
@Autowired
|
||||
AlarmEventListener alarmEventListener;
|
||||
|
||||
@ApiOperation("设置响应")
|
||||
@ApiOperation("浏览器推送")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "browserId", value = "浏览器ID", dataTypeClass = String.class),
|
||||
})
|
||||
@RequestMapping("/emit")
|
||||
@PostMapping("/emit")
|
||||
public SseEmitter emit(@RequestParam String browserId) {
|
||||
final SseEmitter sseEmitter = new SseEmitter(0L);
|
||||
try {
|
||||
|
||||
@@ -44,7 +44,7 @@ public class MediaController {
|
||||
@ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "stream", value = "流id", dataTypeClass = String.class),
|
||||
})
|
||||
@RequestMapping(value = "/getStreamInfoByAppAndStream")
|
||||
@GetMapping(value = "/stream_info_by_app_and_stream")
|
||||
@ResponseBody
|
||||
public StreamInfo getStreamInfoByAppAndStream(String app, String stream){
|
||||
return mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream);
|
||||
|
||||
@@ -32,7 +32,7 @@ public class PlatformGbStreamController {
|
||||
@ApiImplicitParam(name = "page", value = "当前页", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "count", value = "每页条数", dataTypeClass = Integer.class),
|
||||
})
|
||||
@RequestMapping(value = "/list")
|
||||
@GetMapping(value = "/list")
|
||||
@ResponseBody
|
||||
public PageInfo<GbStream> list(@RequestParam(required = false)Integer page,
|
||||
@RequestParam(required = false)Integer count){
|
||||
|
||||
@@ -93,7 +93,7 @@ public class PlayController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "streamId", value = "视频流ID", dataTypeClass = String.class),
|
||||
})
|
||||
@PostMapping("/stop/{streamId}")
|
||||
@GetMapping("/stop/{streamId}")
|
||||
public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String streamId) {
|
||||
|
||||
logger.debug(String.format("设备预览/回放停止API调用,streamId:%s", streamId));
|
||||
|
||||
@@ -105,7 +105,7 @@ public class PlaybackController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "ssrc", value = "视频流标识", dataTypeClass = String.class),
|
||||
})
|
||||
@RequestMapping("/stop/{ssrc}")
|
||||
@GetMapping("/stop/{ssrc}")
|
||||
public ResponseEntity<String> playStop(@PathVariable String ssrc) {
|
||||
|
||||
cmder.streamByeCmd(ssrc);
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ServerController {
|
||||
|
||||
|
||||
@ApiOperation("重启服务")
|
||||
@RequestMapping(value = "/restart")
|
||||
@GetMapping(value = "/restart")
|
||||
@ResponseBody
|
||||
public Object restart(){
|
||||
Thread restartThread = new Thread(new Runnable() {
|
||||
|
||||
@@ -41,7 +41,7 @@ public class StreamProxyController {
|
||||
@ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="online", value = "是否在线", dataTypeClass = Boolean.class),
|
||||
})
|
||||
@RequestMapping(value = "/list")
|
||||
@GetMapping(value = "/list")
|
||||
@ResponseBody
|
||||
public PageInfo<StreamProxyItem> list(@RequestParam(required = false)Integer page,
|
||||
@RequestParam(required = false)Integer count,
|
||||
@@ -55,7 +55,7 @@ public class StreamProxyController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "param", value = "代理参数", dataTypeClass = StreamProxyItem.class),
|
||||
})
|
||||
@RequestMapping(value = "/save")
|
||||
@PostMapping(value = "/save")
|
||||
@ResponseBody
|
||||
public Object save(@RequestBody StreamProxyItem param){
|
||||
logger.info("添加代理: " + JSONObject.toJSONString(param));
|
||||
@@ -68,7 +68,7 @@ public class StreamProxyController {
|
||||
@ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class),
|
||||
})
|
||||
@RequestMapping(value = "/del")
|
||||
@DeleteMapping(value = "/del")
|
||||
@ResponseBody
|
||||
public Object del(String app, String stream){
|
||||
logger.info("移除代理: " + app + "/" + stream);
|
||||
@@ -81,7 +81,7 @@ public class StreamProxyController {
|
||||
@ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class),
|
||||
})
|
||||
@RequestMapping(value = "/start")
|
||||
@GetMapping(value = "/start")
|
||||
@ResponseBody
|
||||
public Object start(String app, String stream){
|
||||
logger.info("启用代理: " + app + "/" + stream);
|
||||
@@ -94,11 +94,11 @@ public class StreamProxyController {
|
||||
@ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class),
|
||||
})
|
||||
@RequestMapping(value = "/stop")
|
||||
@GetMapping(value = "/stop")
|
||||
@ResponseBody
|
||||
public Object stop(String app, String stream){
|
||||
logger.info("停用代理: " + app + "/" + stream);
|
||||
boolean result = streamProxyService.stop(app, stream);
|
||||
return "success";
|
||||
return result?"success":"fail";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class StreamPushController {
|
||||
@ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="online", value = "是否在线", dataTypeClass = Boolean.class),
|
||||
})
|
||||
@RequestMapping(value = "/list")
|
||||
@GetMapping(value = "/list")
|
||||
@ResponseBody
|
||||
public PageInfo<StreamPushItem> list(@RequestParam(required = false)Integer page,
|
||||
@RequestParam(required = false)Integer count,
|
||||
@@ -47,7 +47,7 @@ public class StreamPushController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "stream", value = "直播流关联国标平台", dataTypeClass = GbStream.class),
|
||||
})
|
||||
@RequestMapping(value = "/save_to_gb")
|
||||
@PostMapping(value = "/save_to_gb")
|
||||
@ResponseBody
|
||||
public Object saveToGB(@RequestBody GbStream stream){
|
||||
if (streamPushService.saveToGB(stream)){
|
||||
@@ -62,7 +62,7 @@ public class StreamPushController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "stream", value = "直播流关联国标平台", dataTypeClass = GbStream.class),
|
||||
})
|
||||
@RequestMapping(value = "/remove_form_gb")
|
||||
@DeleteMapping(value = "/remove_form_gb")
|
||||
@ResponseBody
|
||||
public Object removeFormGB(@RequestBody GbStream stream){
|
||||
if (streamPushService.removeFromGB(stream)){
|
||||
|
||||
@@ -8,6 +8,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -28,7 +29,7 @@ public class UserController {
|
||||
@ApiImplicitParam(name = "username", value = "用户名", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "password", value = "密码(32未md5加密)", dataTypeClass = String.class),
|
||||
})
|
||||
@RequestMapping("/login")
|
||||
@GetMapping("/login")
|
||||
public String login(String username, String password){
|
||||
if (!StringUtils.isEmpty(username) && username.equals(usernameConfig)
|
||||
&& !StringUtils.isEmpty(password) && password.equals(passwordConfig)) {
|
||||
|
||||
Reference in New Issue
Block a user