diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java index 8445c7e2..4e223e98 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java @@ -130,11 +130,21 @@ public class ServerController { @PostMapping(value = "/media_server/save") @ResponseBody public WVPResult saveMediaServer(@RequestBody MediaServerItem mediaServerItem){ - if (mediaServerService.getOne(mediaServerItem.getId()) != null) { + MediaServerItem mediaServerItemInDatabase = mediaServerService.getOne(mediaServerItem.getId()); + + if (mediaServerItemInDatabase != null) { + if (StringUtils.isEmpty(mediaServerItemInDatabase.getSendRtpPortRange()) + && StringUtils.isEmpty(mediaServerItem.getSendRtpPortRange())){ + mediaServerItem.setSendRtpPortRange("30000,30500"); + } mediaServerService.update(mediaServerItem); }else { + if (StringUtils.isEmpty(mediaServerItem.getSendRtpPortRange())){ + mediaServerItem.setSendRtpPortRange("30000,30500"); + } return mediaServerService.add(mediaServerItem); } + WVPResult result = new WVPResult<>(); result.setCode(0); result.setMsg("success"); diff --git a/web_src/src/components/MediaServerManger.vue b/web_src/src/components/MediaServerManger.vue index 969d739b..7f6bf22e 100644 --- a/web_src/src/components/MediaServerManger.vue +++ b/web_src/src/components/MediaServerManger.vue @@ -21,7 +21,8 @@ 编辑 移除
- 创建时间: {{item.createTime}} + {{item.ip}} + {{item.createTime}}
diff --git a/web_src/src/components/dialog/MediaServerEdit.vue b/web_src/src/components/dialog/MediaServerEdit.vue index b67daf84..8dab76b9 100644 --- a/web_src/src/components/dialog/MediaServerEdit.vue +++ b/web_src/src/components/dialog/MediaServerEdit.vue @@ -14,7 +14,7 @@ - + @@ -37,7 +37,7 @@ - + @@ -54,13 +54,13 @@ - + - + - + @@ -68,10 +68,10 @@ - + - + @@ -81,23 +81,23 @@ - + - - + + - - + - - + + - - + - + @@ -181,18 +181,29 @@ export default { rtpEnable: false, rtpPortRange: "", sendRtpPortRange: "", - rtpPortRange1: "", - rtpPortRange2: "", - sendRtpPortRange1: "", - sendRtpPortRange2: "", rtpProxyPort: "", rtspPort: "", rtspSSLPort: "", }, + rtpPortRange1:30000, + rtpPortRange2:30500, + sendRtpPortRange1:30000, + sendRtpPortRange2:30500, rules: { ip: [{ required: true, validator: isValidIp, message: '请输入有效的IP地址', trigger: 'blur' }], - port: [{ required: true, validator: isValidPort, message: '请输入有效的端口号', trigger: 'blur' }], + httpPort: [{ required: true, validator: isValidPort, message: '请输入有效的端口号', trigger: 'blur' }], + httpSSlPort: [{ required: true, validator: isValidPort, message: '请输入有效的端口号', trigger: 'blur' }], + recordAssistPort: [{ required: true, validator: isValidPort, message: '请输入有效的端口号', trigger: 'blur' }], + rtmpPort: [{ required: true, validator: isValidPort, message: '请输入有效的端口号', trigger: 'blur' }], + rtmpSSlPort: [{ required: true, validator: isValidPort, message: '请输入有效的端口号', trigger: 'blur' }], + rtpPortRange1: [{ required: true, validator: isValidPort, message: '请输入有效的端口号', trigger: 'blur' }], + rtpPortRange2: [{ required: true, validator: isValidPort, message: '请输入有效的端口号', trigger: 'blur' }], + sendRtpPortRange1: [{ required: true, validator: isValidPort, message: '请输入有效的端口号', trigger: 'blur' }], + sendRtpPortRange2: [{ required: true, validator: isValidPort, message: '请输入有效的端口号', trigger: 'blur' }], + rtpProxyPort: [{ required: true, validator: isValidPort, message: '请输入有效的端口号', trigger: 'blur' }], + rtspPort: [{ required: true, validator: isValidPort, message: '请输入有效的端口号', trigger: 'blur' }], + rtspSSLPort: [{ required: true, validator: isValidPort, message: '请输入有效的端口号', trigger: 'blur' }], secret: [{ required: true, message: "请输入secret", trigger: "blur" }], timeout_ms: [{ required: true, message: "请输入FFmpeg推流成功超时时间", trigger: "blur" }], ffmpeg_cmd_key: [{ required: false, message: "请输入FFmpeg命令参数模板(可选)", trigger: "blur" }], @@ -217,13 +228,13 @@ export default { if (param.rtpPortRange) { let rtpPortRange = this.mediaServerForm.rtpPortRange.split(","); if (rtpPortRange.length > 0) { - this.mediaServerForm["rtpPortRange1"] = rtpPortRange[0] - this.mediaServerForm["rtpPortRange2"] = rtpPortRange[1] + this.rtpPortRange1 = rtpPortRange[0] + this.rtpPortRange2 = rtpPortRange[1] } } let sendRtpPortRange = this.mediaServerForm.sendRtpPortRange.split(","); - this.mediaServerForm["sendRtpPortRange1"] = sendRtpPortRange[0] - this.mediaServerForm["sendRtpPortRange2"] = sendRtpPortRange[1] + this.sendRtpPortRange1 = sendRtpPortRange[0] + this.sendRtpPortRange2 = sendRtpPortRange[1] } }, checkServer: function() { @@ -243,10 +254,10 @@ export default { that.mediaServerForm = data.data; that.mediaServerForm.httpPort = httpPort; that.mediaServerForm.autoConfig = true; - that.mediaServerForm.sendRtpPortRange1 = 30000 - that.mediaServerForm.sendRtpPortRange2 = 30500 - that.mediaServerForm.rtpPortRange1 = 30000 - that.mediaServerForm.rtpPortRange2 = 30500 + that.sendRtpPortRange1 = 30000 + that.sendRtpPortRange2 = 30500 + that.rtpPortRange1 = 30000 + that.rtpPortRange2 = 30500 that.serverCheck = 1; }else { that.serverCheck = -1; @@ -292,10 +303,6 @@ export default { onSubmit: function () { this.dialogLoading = true; let that = this; - if (this.mediaServerForm.rtpEnable) { - this.mediaServerForm.rtpPortRange = this.mediaServerForm.rtpPortRange1 + "," + this.mediaServerForm.rtpPortRange2; - } - this.mediaServerForm.sendRtpPortRange = this.mediaServerForm.sendRtpPortRange1 + "," + this.mediaServerForm.sendRtpPortRange2; that.mediaServer.addServer(this.mediaServerForm, data => { if (data.code === 0) { that.$message({ @@ -334,14 +341,14 @@ export default { rtpEnable: false, rtpPortRange: "", sendRtpPortRange: "", - rtpPortRange1: "", - rtpPortRange2: "", - sendRtpPortRange1: "", - sendRtpPortRange2: "", rtpProxyPort: "", rtspPort: "", rtspSSLPort: "", }; + this.sendRtpPortRange1 = 30000; + this.sendRtpPortRange2 = 30500; + this.rtpPortRange1 = 30500; + this.rtpPortRange2 = 30500; this.listChangeCallback = null this.currentStep = 1; }, @@ -362,6 +369,12 @@ export default { if (this.platform.enable && this.platform.expires == "0") { this.platform.expires = "300"; } + }, + portRangeChange: function() { + this.mediaServerForm.sendRtpPortRange = this.sendRtpPortRange1 + "," + this.sendRtpPortRange2 + this.mediaServerForm.rtpPortRange = this.rtpPortRange1 + "," + this.rtpPortRange2 + console.log(this.mediaServerForm.sendRtpPortRange) + console.log(this.mediaServerForm.rtpPortRange) } }, };