Commit 560165b6679f96f04cd3f8f6d5709b1214afddfb

Authored by wangyimeng
1 parent f97ce3e9

增加拉流代理修改功能

src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java
@@ -75,7 +75,28 @@ public class StreamProxyController { @@ -75,7 +75,28 @@ public class StreamProxyController {
75 WVPResult<StreamInfo> result = streamProxyService.save(param); 75 WVPResult<StreamInfo> result = streamProxyService.save(param);
76 return result; 76 return result;
77 } 77 }
78 - 78 + @ApiOperation("修改代理")
  79 + @ApiImplicitParams({
  80 + @ApiImplicitParam(name = "param", value = "代理参数", dataTypeClass = StreamProxyItem.class),
  81 + })
  82 + @PostMapping(value = "/update")
  83 + @ResponseBody
  84 + public WVPResult update(@RequestBody StreamProxyItem param){
  85 + logger.info("修改代理: " + JSONObject.toJSONString(param));
  86 + WVPResult<StreamInfo> result = new WVPResult<>();
  87 + if(StringUtils.isEmpty(param.getApp())||StringUtils.isEmpty(param.getStream())){
  88 + result.setCode(400);
  89 + result.setMsg("app不能为null且stream不能为null,请检查具体参数!");
  90 + return result;
  91 + }
  92 + streamProxyService.del(param.getApp(), param.getStream());
  93 + if (StringUtils.isEmpty(param.getMediaServerId())) param.setMediaServerId("auto");
  94 + if (StringUtils.isEmpty(param.getType())) param.setType("default");
  95 + if (StringUtils.isEmpty(param.getGbId())) param.setGbId(null);
  96 + param.setEnable(false);
  97 + result = streamProxyService.save(param);
  98 + return result;
  99 + }
79 @ApiOperation("获取ffmpeg.cmd模板") 100 @ApiOperation("获取ffmpeg.cmd模板")
80 @GetMapping(value = "/ffmpeg_cmd/list") 101 @GetMapping(value = "/ffmpeg_cmd/list")
81 @ApiImplicitParams({ 102 @ApiImplicitParams({
web_src/src/components/dialog/StreamProxyEdit.vue
@@ -131,22 +131,6 @@ export default { @@ -131,22 +131,6 @@ export default {
131 computed: {}, 131 computed: {},
132 created() {}, 132 created() {},
133 data() { 133 data() {
134 - // var deviceGBIdRules = async (rule, value, callback) => {  
135 - // console.log(value);  
136 - // if (value === "") {  
137 - // callback(new Error("请输入设备国标编号"));  
138 - // } else {  
139 - // var exit = await this.deviceGBIdExit(value);  
140 - // console.log(exit);  
141 - // console.log(exit == "true");  
142 - // console.log(exit === "true");  
143 - // if (exit) {  
144 - // callback(new Error("设备国标编号已存在"));  
145 - // } else {  
146 - // callback();  
147 - // }  
148 - // }  
149 - // };  
150 return { 134 return {
151 listChangeCallback: null, 135 listChangeCallback: null,
152 showDialog: false, 136 showDialog: false,
@@ -185,6 +169,7 @@ export default { @@ -185,6 +169,7 @@ export default {
185 timeout_ms: [{ required: true, message: "请输入FFmpeg推流成功超时时间", trigger: "blur" }], 169 timeout_ms: [{ required: true, message: "请输入FFmpeg推流成功超时时间", trigger: "blur" }],
186 ffmpeg_cmd_key: [{ required: false, message: "请输入FFmpeg命令参数模板(可选)", trigger: "blur" }], 170 ffmpeg_cmd_key: [{ required: false, message: "请输入FFmpeg命令参数模板(可选)", trigger: "blur" }],
187 }, 171 },
  172 + isUpdate: false,
188 }; 173 };
189 }, 174 },
190 methods: { 175 methods: {
@@ -192,13 +177,14 @@ export default { @@ -192,13 +177,14 @@ export default {
192 this.showDialog = true; 177 this.showDialog = true;
193 this.listChangeCallback = callback; 178 this.listChangeCallback = callback;
194 if (proxyParam != null) { 179 if (proxyParam != null) {
  180 + this.isUpdate=true
195 this.proxyParam = proxyParam; 181 this.proxyParam = proxyParam;
196 } 182 }
197 183
198 let that = this; 184 let that = this;
199 this.$axios({ 185 this.$axios({
200 method: 'get', 186 method: 'get',
201 - url:`/api/platform/query/10000/0` 187 + url:`/api/platform/query/100/1`
202 }).then(function (res) { 188 }).then(function (res) {
203 that.platformList = res.data.list; 189 that.platformList = res.data.list;
204 }).catch(function (error) { 190 }).catch(function (error) {
@@ -229,28 +215,54 @@ export default { @@ -229,28 +215,54 @@ export default {
229 onSubmit: function () { 215 onSubmit: function () {
230 this.dialogLoading = true; 216 this.dialogLoading = true;
231 var that = this; 217 var that = this;
232 - that.$axios({  
233 - method: 'post',  
234 - url:`/api/proxy/save`,  
235 - data: that.proxyParam  
236 - }).then(function (res) {  
237 - that.dialogLoading = false;  
238 - if (typeof (res.data.code) != "undefined" && res.data.code === 0) {  
239 - that.$message({  
240 - showClose: true,  
241 - message: res.data.msg,  
242 - type: "success",  
243 - });  
244 - that.showDialog = false;  
245 - if (that.listChangeCallback != null) {  
246 - that.listChangeCallback();  
247 - that.dialogLoading = false; 218 + if(this.isUpdate){
  219 + that.$axios({
  220 + method: 'post',
  221 + url:`/api/proxy/update`,
  222 + data: that.proxyParam
  223 + }).then(function (res) {
  224 + that.dialogLoading = false;
  225 + if (typeof (res.data.code) != "undefined" && res.data.code === 0) {
  226 + that.$message({
  227 + showClose: true,
  228 + message: res.data.msg,
  229 + type: "success",
  230 + });
  231 + that.showDialog = false;
  232 + if (that.listChangeCallback != null) {
  233 + that.listChangeCallback();
  234 + that.dialogLoading = false;
  235 + }
248 } 236 }
249 - }  
250 - }).catch(function (error) {  
251 - console.log(error);  
252 - this.dialogLoading = false;  
253 - }); 237 + }).catch(function (error) {
  238 + console.log(error);
  239 + this.dialogLoading = false;
  240 + });
  241 + }else{
  242 + that.$axios({
  243 + method: 'post',
  244 + url:`/api/proxy/save`,
  245 + data: that.proxyParam
  246 + }).then(function (res) {
  247 + that.dialogLoading = false;
  248 + if (typeof (res.data.code) != "undefined" && res.data.code === 0) {
  249 + that.$message({
  250 + showClose: true,
  251 + message: res.data.msg,
  252 + type: "success",
  253 + });
  254 + that.showDialog = false;
  255 + if (that.listChangeCallback != null) {
  256 + that.listChangeCallback();
  257 + that.dialogLoading = false;
  258 + }
  259 + }
  260 + }).catch(function (error) {
  261 + console.log(error);
  262 + this.dialogLoading = false;
  263 + });
  264 + }
  265 +
254 }, 266 },
255 close: function () { 267 close: function () {
256 this.showDialog = false; 268 this.showDialog = false;