修复拉流看方式回显

pull/1642/head
648540858 2024-07-22 11:07:58 +08:00
parent 0b7d55ed74
commit 2f4d983f9f
5 changed files with 23 additions and 12 deletions

View File

@ -126,7 +126,7 @@ public class StreamProxyController {
}) })
@PostMapping(value = "/update") @PostMapping(value = "/update")
@ResponseBody @ResponseBody
public void update(@RequestBody StreamProxy param){ public StreamProxy update(@RequestBody StreamProxy param){
log.info("更新代理: " + JSONObject.toJSONString(param)); log.info("更新代理: " + JSONObject.toJSONString(param));
if (param.getId() == 0) { if (param.getId() == 0) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "缺少代理信息的ID"); throw new ControllerException(ErrorCode.ERROR400.getCode(), "缺少代理信息的ID");
@ -135,6 +135,7 @@ public class StreamProxyController {
param.setGbDeviceId(null); param.setGbDeviceId(null);
} }
streamProxyService.update(param); streamProxyService.update(param);
return param;
} }
@GetMapping(value = "/ffmpeg_cmd/list") @GetMapping(value = "/ffmpeg_cmd/list")
@ -170,7 +171,7 @@ public class StreamProxyController {
@Operation(summary = "移除代理", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Operation(summary = "移除代理", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "id", description = "代理ID", required = true) @Parameter(name = "id", description = "代理ID", required = true)
public void delte(int id){ public void delte(int id){
log.info("移除代理: " + id ); log.info("移除代理: {}", id);
streamProxyService.delete(id); streamProxyService.delete(id);
} }
@ -179,7 +180,7 @@ public class StreamProxyController {
@Operation(summary = "启用代理", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Operation(summary = "启用代理", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "id", description = "代理Id", required = true) @Parameter(name = "id", description = "代理Id", required = true)
public StreamContent start(int id){ public StreamContent start(int id){
log.info("播放代理: " + id); log.info("播放代理: {}", id);
StreamInfo streamInfo = streamProxyService.start(id); StreamInfo streamInfo = streamProxyService.start(id);
if (streamInfo == null) { if (streamInfo == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), ErrorCode.ERROR100.getMsg()); throw new ControllerException(ErrorCode.ERROR100.getCode(), ErrorCode.ERROR100.getMsg());

View File

@ -161,9 +161,6 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
streamProxy.setUpdateTime(DateUtil.getNow()); streamProxy.setUpdateTime(DateUtil.getNow());
streamProxyMapper.add(streamProxy); streamProxyMapper.add(streamProxy);
streamProxy.setStreamProxyId(streamProxy.getId()); streamProxy.setStreamProxyId(streamProxy.getId());
if (streamProxy.isEnable()) {
return startProxy(streamProxy);
}
return null; return null;
} }

View File

@ -2,4 +2,4 @@ spring:
application: application:
name: wvp name: wvp
profiles: profiles:
active: local active: 272重构

View File

@ -21,8 +21,8 @@
style="width: 100%" style="width: 100%"
placeholder="请选择代理类型" placeholder="请选择代理类型"
> >
<el-option label="默认" value="default"></el-option> <el-option key="默认" label="默认" value="default"></el-option>
<el-option label="FFmpeg" value="ffmpeg"></el-option> <el-option key="FFmpeg" label="FFmpeg" value="ffmpeg"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="应用名" prop="app"> <el-form-item label="应用名" prop="app">
@ -67,7 +67,7 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="拉流方式(RTSP)" prop="rtpType"> <el-form-item label="拉流方式(RTSP)" prop="rtspType">
<el-select <el-select
v-model="streamProxy.rtspType" v-model="streamProxy.rtspType"
style="width: 100%" style="width: 100%"
@ -127,6 +127,11 @@ export default {
this.mediaServerList = data.data; this.mediaServerList = data.data;
}) })
}, },
watch: {
value(newValue, oldValue){
this.streamProxy = newValue;
}
},
data() { data() {
return { return {
saveLoading: false, saveLoading: false,
@ -159,10 +164,12 @@ export default {
this.saveLoading = false; this.saveLoading = false;
if (typeof (res.data.code) != "undefined" && res.data.code === 0) { if (typeof (res.data.code) != "undefined" && res.data.code === 0) {
this.$message.success("保存成功"); this.$message.success("保存成功");
console.log(res.data.data)
this.streamProxy = res.data.data this.streamProxy = res.data.data
}else { }else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
this.saveLoading = false;
}).catch((error) =>{ }).catch((error) =>{
this.$message.error(error); this.$message.error(error);
this.saveLoading = false; this.saveLoading = false;
@ -214,7 +221,7 @@ export default {
}, },
noneReaderHandler: function() { noneReaderHandler: function() {
console.log(this.streamProxy) console.log(this.streamProxy)
if (this.streamProxy.noneReader === null || this.streamProxy.noneReader === 0 || !this.streamProxy.noneReader) { if (!this.streamProxy.noneReader || this.streamProxy.noneReader === 0 ) {
this.streamProxy.enableDisableNoneReader = false; this.streamProxy.enableDisableNoneReader = false;
this.streamProxy.enableRemoveNoneReader = false; this.streamProxy.enableRemoveNoneReader = false;
}else if (this.streamProxy.noneReader === 1){ }else if (this.streamProxy.noneReader === 1){

View File

@ -159,7 +159,12 @@
window.clearInterval(this.updateLooper) window.clearInterval(this.updateLooper)
}, },
startUpdateList: function (){ startUpdateList: function (){
this.updateLooper = setInterval(this.getStreamProxyList, 1000); this.updateLooper = setInterval(()=>{
if (!this.streamProxy) {
this.getStreamProxyList()
}
}, 1000);
}, },
currentChange: function(val){ currentChange: function(val){
this.currentPage = val; this.currentPage = val;
@ -238,6 +243,7 @@
this.$set(row, "noneReader", 0) this.$set(row, "noneReader", 0)
} }
this.streamProxy = row this.streamProxy = row
this.$set(this.streamProxy, "rtspType", row.rtspType)
}, },
closeEdit: function(row){ closeEdit: function(row){
this.streamProxy = null this.streamProxy = null