临时提交

pull/1642/head
648540858 2024-07-22 14:20:40 +08:00
parent 2f4d983f9f
commit c96c29776d
4 changed files with 37 additions and 8 deletions

View File

@ -192,10 +192,9 @@ public class StreamProxyController {
@GetMapping(value = "/stop") @GetMapping(value = "/stop")
@ResponseBody @ResponseBody
@Operation(summary = "停用代理", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Operation(summary = "停用代理", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "app", description = "应用名", required = true) @Parameter(name = "id", description = "代理Id", required = true)
@Parameter(name = "stream", description = "流id", required = true) public void stop(int id){
public void stop(String app, String stream){ log.info("停用代理: {}", id);
log.info("停用代理: " + app + "/" + stream); streamProxyService.stop(id);
streamProxyService.stopByAppAndStream(app, stream);
} }
} }

View File

@ -94,4 +94,6 @@ public interface IStreamProxyService {
void delete(int id); void delete(int id);
StreamInfo start(int id); StreamInfo start(int id);
void stop(int id);
} }

View File

@ -474,8 +474,14 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
return streamProxyMapper.select(id); return streamProxyMapper.select(id);
} }
@Override
public void stop(int id) {
StreamProxy streamProxy = streamProxyMapper.select(id);
if (streamProxy == null) {
throw new ControllerException(ErrorCode.ERROR404.getCode(), "代理信息未找到");
}
stopProxy(streamProxy);
}
// @Scheduled(cron = "* 0/10 * * * ?") // @Scheduled(cron = "* 0/10 * * * ?")
// public void asyncCheckStreamProxyStatus() { // public void asyncCheckStreamProxyStatus() {

View File

@ -74,8 +74,10 @@
<el-table-column prop="createTime" label="创建时间" min-width="150" show-overflow-tooltip/> <el-table-column prop="createTime" label="创建时间" min-width="150" show-overflow-tooltip/>
<el-table-column label="操作" width="360" fixed="right"> <el-table-column label="操作" width="360" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="medium" icon="el-icon-video-play" type="text" v-if="scope.row.enable" @click="play(scope.row)"></el-button> <el-button size="medium" icon="el-icon-video-play" type="text" @click="play(scope.row)"></el-button>
<el-divider direction="vertical"></el-divider> <el-divider direction="vertical"></el-divider>
<el-button size="medium" icon="el-icon-switch-button" style="color: #f56c6c" type="text" v-if="scope.row.pulling" @click="stopPlay(scope.row)"></el-button>
<el-divider direction="vertical" v-if="scope.row.pulling" ></el-divider>
<el-button size="medium" icon="el-icon-edit" type="text" @click="edit(scope.row)"> <el-button size="medium" icon="el-icon-edit" type="text" @click="edit(scope.row)">
编辑 编辑
</el-button> </el-button>
@ -274,6 +276,26 @@
console.log(error); console.log(error);
}); });
},
stopPlay: function(row){
let that = this;
this.$axios({
method: 'get',
url:`/api/proxy/stop`,
params: {
id: row.id,
}
}).then(function (res) {
if (res.data.code === 0) {
}else {
that.$message.error(res.data.msg);
}
}).catch(function (error) {
console.log(error);
});
}, },
queryCloudRecords: function (row) { queryCloudRecords: function (row) {