From 560165b6679f96f04cd3f8f6d5709b1214afddfb Mon Sep 17 00:00:00 2001 From: wangyimeng <421132955@qq.com> Date: 星期六, 26 二月 2022 11:14:56 +0800 Subject: [PATCH] 增加拉流代理修改功能 --- src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java | 23 +++++++++++ web_src/src/components/dialog/StreamProxyEdit.vue | 88 +++++++++++++++++++++++++------------------- 2 files changed, 72 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java index 1226eb7..5f02b2a 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java @@ -75,7 +75,28 @@ WVPResult<StreamInfo> result = streamProxyService.save(param); return result; } - + @ApiOperation("淇敼浠g悊") + @ApiImplicitParams({ + @ApiImplicitParam(name = "param", value = "浠g悊鍙傛暟", dataTypeClass = StreamProxyItem.class), + }) + @PostMapping(value = "/update") + @ResponseBody + public WVPResult update(@RequestBody StreamProxyItem param){ + logger.info("淇敼浠g悊锛� " + JSONObject.toJSONString(param)); + WVPResult<StreamInfo> result = new WVPResult<>(); + if(StringUtils.isEmpty(param.getApp())||StringUtils.isEmpty(param.getStream())){ + result.setCode(400); + result.setMsg("app涓嶈兘涓簄ull涓攕tream涓嶈兘涓簄ull锛岃妫�鏌ュ叿浣撳弬鏁帮紒"); + return result; + } + streamProxyService.del(param.getApp(), param.getStream()); + if (StringUtils.isEmpty(param.getMediaServerId())) param.setMediaServerId("auto"); + if (StringUtils.isEmpty(param.getType())) param.setType("default"); + if (StringUtils.isEmpty(param.getGbId())) param.setGbId(null); + param.setEnable(false); + result = streamProxyService.save(param); + return result; + } @ApiOperation("鑾峰彇ffmpeg.cmd妯℃澘") @GetMapping(value = "/ffmpeg_cmd/list") @ApiImplicitParams({ diff --git a/web_src/src/components/dialog/StreamProxyEdit.vue b/web_src/src/components/dialog/StreamProxyEdit.vue index 8d3fe26..d5a9529 100644 --- a/web_src/src/components/dialog/StreamProxyEdit.vue +++ b/web_src/src/components/dialog/StreamProxyEdit.vue @@ -131,22 +131,6 @@ computed: {}, created() {}, data() { - // var deviceGBIdRules = async (rule, value, callback) => { - // console.log(value); - // if (value === "") { - // callback(new Error("璇疯緭鍏ヨ澶囧浗鏍囩紪鍙�")); - // } else { - // var exit = await this.deviceGBIdExit(value); - // console.log(exit); - // console.log(exit == "true"); - // console.log(exit === "true"); - // if (exit) { - // callback(new Error("璁惧鍥芥爣缂栧彿宸插瓨鍦�")); - // } else { - // callback(); - // } - // } - // }; return { listChangeCallback: null, showDialog: false, @@ -185,6 +169,7 @@ timeout_ms: [{ required: true, message: "璇疯緭鍏Fmpeg鎺ㄦ祦鎴愬姛瓒呮椂鏃堕棿", trigger: "blur" }], ffmpeg_cmd_key: [{ required: false, message: "璇疯緭鍏Fmpeg鍛戒护鍙傛暟妯℃澘锛堝彲閫夛級", trigger: "blur" }], }, + isUpdate: false, }; }, methods: { @@ -192,13 +177,14 @@ this.showDialog = true; this.listChangeCallback = callback; if (proxyParam != null) { + this.isUpdate=true this.proxyParam = proxyParam; } let that = this; this.$axios({ method: 'get', - url:`/api/platform/query/10000/0` + url:`/api/platform/query/100/1` }).then(function (res) { that.platformList = res.data.list; }).catch(function (error) { @@ -229,28 +215,54 @@ onSubmit: function () { this.dialogLoading = true; var that = this; - that.$axios({ - method: 'post', - url:`/api/proxy/save`, - data: that.proxyParam - }).then(function (res) { - that.dialogLoading = false; - if (typeof (res.data.code) != "undefined" && res.data.code === 0) { - that.$message({ - showClose: true, - message: res.data.msg, - type: "success", - }); - that.showDialog = false; - if (that.listChangeCallback != null) { - that.listChangeCallback(); - that.dialogLoading = false; + if(this.isUpdate){ + that.$axios({ + method: 'post', + url:`/api/proxy/update`, + data: that.proxyParam + }).then(function (res) { + that.dialogLoading = false; + if (typeof (res.data.code) != "undefined" && res.data.code === 0) { + that.$message({ + showClose: true, + message: res.data.msg, + type: "success", + }); + that.showDialog = false; + if (that.listChangeCallback != null) { + that.listChangeCallback(); + that.dialogLoading = false; + } } - } - }).catch(function (error) { - console.log(error); - this.dialogLoading = false; - }); + }).catch(function (error) { + console.log(error); + this.dialogLoading = false; + }); + }else{ + that.$axios({ + method: 'post', + url:`/api/proxy/save`, + data: that.proxyParam + }).then(function (res) { + that.dialogLoading = false; + if (typeof (res.data.code) != "undefined" && res.data.code === 0) { + that.$message({ + showClose: true, + message: res.data.msg, + type: "success", + }); + that.showDialog = false; + if (that.listChangeCallback != null) { + that.listChangeCallback(); + that.dialogLoading = false; + } + } + }).catch(function (error) { + console.log(error); + this.dialogLoading = false; + }); + } + }, close: function () { this.showDialog = false; -- Gitblit v1.8.0