From 1b677c6dc79b8e3b650acd94da7fc770c3d2718d Mon Sep 17 00:00:00 2001
From: 64850858 <648540858@qq.com>
Date: 星期五, 04 六月 2021 16:31:45 +0800
Subject: [PATCH] 增加zlm代理的secret自动添加, 增加配置文件的默认值,缺少非关键参数不会无法启动,简化配置文件给新手带来的压力,前端使用wvp代理流。

---
 src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 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 8914fc1..2baa999 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
@@ -4,6 +4,7 @@
 import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.service.IStreamProxyService;
+import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -56,10 +57,13 @@
     })
     @PostMapping(value = "/save")
     @ResponseBody
-    public Object save(@RequestBody StreamProxyItem param){
+    public WVPResult save(@RequestBody StreamProxyItem param){
         logger.info("娣诲姞浠g悊锛� " + JSONObject.toJSONString(param));
-        streamProxyService.save(param);
-        return "success";
+        String msg = streamProxyService.save(param);
+        WVPResult<Object> result = new WVPResult<>();
+        result.setCode(0);
+        result.setMsg(msg);
+        return result;
     }
 
     @ApiOperation("绉婚櫎浠g悊")
@@ -69,10 +73,18 @@
     })
     @DeleteMapping(value = "/del")
     @ResponseBody
-    public Object del(String app, String stream){
+    public WVPResult del(String app, String stream){
         logger.info("绉婚櫎浠g悊锛� " + app + "/" + stream);
-        streamProxyService.del(app, stream);
-        return "success";
+        WVPResult<Object> result = new WVPResult<>();
+        if (app == null || stream == null) {
+            result.setCode(400);
+            result.setMsg(app == null ?"app涓嶈兘涓簄ull":"stream涓嶈兘涓簄ull");
+        }else {
+            streamProxyService.del(app, stream);
+            result.setCode(0);
+            result.setMsg("success");
+        }
+        return result;
     }
 
     @ApiOperation("鍚敤浠g悊")
@@ -85,7 +97,7 @@
     public Object start(String app, String stream){
         logger.info("鍚敤浠g悊锛� " + app + "/" + stream);
         boolean result = streamProxyService.start(app, stream);
-        return "success";
+        return result?"success":"fail";
     }
 
     @ApiOperation("鍋滅敤浠g悊")

--
Gitblit v1.8.0