增加拉流代理修改功能

This commit is contained in:
wangyimeng 2022-02-26 11:14:56 +08:00
parent 36593f8c3b
commit 45ca3a6808
2 changed files with 72 additions and 39 deletions

View File

@ -75,7 +75,28 @@ public class StreamProxyController {
WVPResult<StreamInfo> result = streamProxyService.save(param);
return result;
}
@ApiOperation("修改代理")
@ApiImplicitParams({
@ApiImplicitParam(name = "param", value = "代理参数", dataTypeClass = StreamProxyItem.class),
})
@PostMapping(value = "/update")
@ResponseBody
public WVPResult update(@RequestBody StreamProxyItem param){
logger.info("修改代理: " + JSONObject.toJSONString(param));
WVPResult<StreamInfo> result = new WVPResult<>();
if(StringUtils.isEmpty(param.getApp())||StringUtils.isEmpty(param.getStream())){
result.setCode(400);
result.setMsg("app不能为null且stream不能为null请检查具体参数");
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({

View File

@ -131,22 +131,6 @@ export default {
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 @@ export default {
timeout_ms: [{ required: true, message: "请输入FFmpeg推流成功超时时间", trigger: "blur" }],
ffmpeg_cmd_key: [{ required: false, message: "请输入FFmpeg命令参数模板可选", trigger: "blur" }],
},
isUpdate: false,
};
},
methods: {
@ -192,13 +177,14 @@ export default {
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 @@ export default {
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;