From 26a52d2d16609c4eac6785cfadaa1c870fe621a2 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 22 Aug 2022 16:16:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=85=A8=E5=B1=80=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E5=92=8C=E7=BB=9F=E4=B8=80=E8=BF=94=E5=9B=9E=E7=BB=93?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/conf/GlobalResponseAdvice.java | 10 +- .../iot/vmp/service/bean/PlayBackResult.java | 12 +- .../iot/vmp/service/impl/PlayServiceImpl.java | 38 +- .../vmanager/gb28181/play/PlayController.java | 75 +--- .../gb28181/playback/PlaybackController.java | 15 +- web_src/src/components/CloudRecordDetail.vue | 5 +- web_src/src/components/ParentPlatformList.vue | 4 +- web_src/src/components/PushVideoList.vue | 4 +- web_src/src/components/StreamProxyList.vue | 16 +- web_src/src/components/UserManager.vue | 6 +- web_src/src/components/channelList.vue | 29 +- web_src/src/components/common/ h265web.vue | 327 ++++++++++++++++++ web_src/src/components/control.vue | 4 +- .../src/components/dialog/StreamProxyEdit.vue | 2 +- .../components/dialog/SyncChannelProgress.vue | 2 +- web_src/src/components/dialog/addUser.vue | 5 - web_src/src/components/dialog/catalogEdit.vue | 3 +- .../src/components/dialog/changePassword.vue | 2 +- .../dialog/changePasswordForAdmin.vue | 2 +- .../src/components/dialog/changePushKey.vue | 3 +- .../src/components/dialog/chooseChannel.vue | 2 +- .../dialog/chooseChannelForCatalog.vue | 9 +- .../dialog/chooseChannelForStream.vue | 16 +- web_src/src/components/dialog/deviceEdit.vue | 2 +- .../src/components/dialog/devicePlayer.vue | 5 +- web_src/src/components/dialog/onvifEdit.vue | 2 +- .../src/components/dialog/pushStreamEdit.vue | 2 +- .../src/components/dialog/recordDownload.vue | 21 +- web_src/src/components/live.vue | 3 - web_src/src/components/map.vue | 1 - .../src/components/service/DeviceService.js | 20 +- 31 files changed, 461 insertions(+), 186 deletions(-) create mode 100644 web_src/src/components/common/ h265web.vue diff --git a/src/main/java/com/genersoft/iot/vmp/conf/GlobalResponseAdvice.java b/src/main/java/com/genersoft/iot/vmp/conf/GlobalResponseAdvice.java index 4e900e27..e1088e56 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/GlobalResponseAdvice.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/GlobalResponseAdvice.java @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.conf; import com.alibaba.fastjson.JSON; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; +import org.jetbrains.annotations.NotNull; import org.springframework.core.MethodParameter; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; @@ -13,20 +14,21 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; /** * 全局统一返回结果 + * @author lin */ @RestControllerAdvice public class GlobalResponseAdvice implements ResponseBodyAdvice { @Override - public boolean supports(MethodParameter returnType, Class> converterType) { + public boolean supports(@NotNull MethodParameter returnType, @NotNull Class> converterType) { return true; } @Override - public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) { + public Object beforeBodyWrite(Object body, @NotNull MethodParameter returnType, @NotNull MediaType selectedContentType, @NotNull Class> selectedConverterType, @NotNull ServerHttpRequest request, @NotNull ServerHttpResponse response) { // 排除api文档的接口,这个接口不需要统一 - String[] excludePath = {"/v3/api-docs","/api/v1"}; + String[] excludePath = {"/v3/api-docs","/api/v1","/index/hook"}; for (String path : excludePath) { if (request.getURI().getPath().startsWith(path)) { return body; @@ -43,7 +45,7 @@ public class GlobalResponseAdvice implements ResponseBodyAdvice { } if (body instanceof String) { - return JSON.toJSON(WVPResult.success(body)); + return JSON.toJSONString(WVPResult.success(body)); } return WVPResult.success(body); diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/PlayBackResult.java b/src/main/java/com/genersoft/iot/vmp/service/bean/PlayBackResult.java index 8029b5af..af86196c 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/bean/PlayBackResult.java +++ b/src/main/java/com/genersoft/iot/vmp/service/bean/PlayBackResult.java @@ -4,14 +4,18 @@ import com.alibaba.fastjson.JSONObject; import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; -import javax.sip.RequestEvent; +import java.util.EventObject; + +/** + * @author lin + */ public class PlayBackResult { private int code; private T data; private MediaServerItem mediaServerItem; private JSONObject response; - private SipSubscribe.EventResult event; + private SipSubscribe.EventResult event; public int getCode() { return code; @@ -45,11 +49,11 @@ public class PlayBackResult { this.response = response; } - public SipSubscribe.EventResult getEvent() { + public SipSubscribe.EventResult getEvent() { return event; } - public void setEvent(SipSubscribe.EventResult event) { + public void setEvent(SipSubscribe.EventResult event) { this.event = event; } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java index 37426716..e7845d11 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java @@ -12,8 +12,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Service; import org.springframework.web.context.request.async.DeferredResult; @@ -362,7 +360,7 @@ public class PlayServiceImpl implements IPlayService { resultHolder.invokeAllResult(msg); } else { logger.warn("设备预览API调用失败!"); - msg.setData("设备预览API调用失败!"); + msg.setData(WVPResult.fail(ErrorCode.ERROR100.getCode(), "设备预览API调用失败!")); resultHolder.invokeAllResult(msg); } } @@ -415,16 +413,15 @@ public class PlayServiceImpl implements IPlayService { } DeferredResult result = new DeferredResult<>(30000L); resultHolder.put(DeferredResultHolder.CALLBACK_CMD_PLAYBACK + deviceId + channelId, uuid, result); - RequestMessage msg = new RequestMessage(); - msg.setId(uuid); - msg.setKey(key); + RequestMessage requestMessage = new RequestMessage(); + requestMessage.setId(uuid); + requestMessage.setKey(key); PlayBackResult playBackResult = new PlayBackResult<>(); - String playBackTimeOutTaskKey = UUID.randomUUID().toString(); + String playBackTimeOutTaskKey = UUID.randomUUID().toString(); dynamicTask.startDelay(playBackTimeOutTaskKey, ()->{ logger.warn(String.format("设备回放超时,deviceId:%s ,channelId:%s", deviceId, channelId)); playBackResult.setCode(-1); - playBackResult.setData(msg); - playBackCallback.call(playBackResult); + playBackResult.setData(requestMessage); SIPDialog dialog = streamSession.getDialogByStream(deviceId, channelId, ssrcInfo.getStream()); // 点播超时回复BYE 同时释放ssrc以及此次点播的资源 if (dialog != null) { @@ -447,24 +444,23 @@ public class PlayServiceImpl implements IPlayService { StreamInfo streamInfo = onPublishHandler(inviteStreamInfo.getMediaServerItem(), inviteStreamInfo.getResponse(), deviceId, channelId); if (streamInfo == null) { logger.warn("设备回放API调用失败!"); - msg.setData("设备回放API调用失败!"); playBackResult.setCode(-1); - playBackResult.setData(msg); playBackCallback.call(playBackResult); return; } redisCatchStorage.startPlayback(streamInfo, inviteStreamInfo.getCallId()); - msg.setData(JSON.toJSONString(streamInfo)); + WVPResult success = WVPResult.success(streamInfo); + requestMessage.setData(success); playBackResult.setCode(0); - playBackResult.setData(msg); + playBackResult.setData(requestMessage); playBackResult.setMediaServerItem(inviteStreamInfo.getMediaServerItem()); playBackResult.setResponse(inviteStreamInfo.getResponse()); playBackCallback.call(playBackResult); }, event -> { dynamicTask.stop(playBackTimeOutTaskKey); - msg.setData(String.format("回放失败, 错误码: %s, %s", event.statusCode, event.msg)); + requestMessage.setData(WVPResult.fail(ErrorCode.ERROR100.getCode(), String.format("回放失败, 错误码: %s, %s", event.statusCode, event.msg))); playBackResult.setCode(-1); - playBackResult.setData(msg); + playBackResult.setData(requestMessage); playBackResult.setEvent(event); playBackCallback.call(playBackResult); streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); @@ -498,13 +494,13 @@ public class PlayServiceImpl implements IPlayService { } resultHolder.put(key, uuid, result); - RequestMessage msg = new RequestMessage(); - msg.setId(uuid); - msg.setKey(key); + RequestMessage requestMessage = new RequestMessage(); + requestMessage.setId(uuid); + requestMessage.setKey(key); WVPResult wvpResult = new WVPResult<>(); - msg.setData(wvpResult); + requestMessage.setData(wvpResult); PlayBackResult downloadResult = new PlayBackResult<>(); - downloadResult.setData(msg); + downloadResult.setData(requestMessage); String downLoadTimeOutTaskKey = UUID.randomUUID().toString(); dynamicTask.startDelay(downLoadTimeOutTaskKey, ()->{ @@ -606,7 +602,7 @@ public class PlayServiceImpl implements IPlayService { resultHolder.invokeResult(msg); } else { logger.warn("设备预览API调用失败!"); - msg.setData("设备预览API调用失败!"); + msg.setData(WVPResult.fail(ErrorCode.ERROR100.getCode(), "设备预览API调用失败!")); resultHolder.invokeResult(msg); } } diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java index f094506a..5d9bb2b9 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java @@ -24,8 +24,6 @@ import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -80,7 +78,7 @@ public class PlayController { @Parameter(name = "deviceId", description = "设备国标编号", required = true) @Parameter(name = "channelId", description = "通道国标编号", required = true) @GetMapping("/start/{deviceId}/{channelId}") - public DeferredResult play(@PathVariable String deviceId, + public DeferredResult> play(@PathVariable String deviceId, @PathVariable String channelId) { // 获取可用的zlm @@ -96,72 +94,33 @@ public class PlayController { @Parameter(name = "deviceId", description = "设备国标编号", required = true) @Parameter(name = "channelId", description = "通道国标编号", required = true) @GetMapping("/stop/{deviceId}/{channelId}") - public DeferredResult playStop(@PathVariable String deviceId, @PathVariable String channelId) { + public JSONObject playStop(@PathVariable String deviceId, @PathVariable String channelId) { logger.debug(String.format("设备预览/回放停止API调用,streamId:%s_%s", deviceId, channelId )); - String uuid = UUID.randomUUID().toString(); - DeferredResult result = new DeferredResult<>(); + if (deviceId == null || channelId == null) { + throw new ControllerException(ErrorCode.ERROR400); + } - // 录像查询以channelId作为deviceId查询 - String key = DeferredResultHolder.CALLBACK_CMD_STOP + deviceId + channelId; - resultHolder.put(key, uuid, result); StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channelId); if (streamInfo == null) { - RequestMessage msg = new RequestMessage(); - msg.setId(uuid); - msg.setKey(key); - msg.setData("点播未找到"); - resultHolder.invokeAllResult(msg); - storager.stopPlay(deviceId, channelId); - return result; - } - cmder.streamByeCmd(deviceId, channelId, streamInfo.getStream(), null, eventResult -> { - redisCatchStorage.stopPlay(streamInfo); - storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId()); - RequestMessage msgForSuccess = new RequestMessage(); - msgForSuccess.setId(uuid); - msgForSuccess.setKey(key); - msgForSuccess.setData(String.format("success")); - resultHolder.invokeAllResult(msgForSuccess); - }); - - if (deviceId != null || channelId != null) { - JSONObject json = new JSONObject(); - json.put("deviceId", deviceId); - json.put("channelId", channelId); - RequestMessage msg = new RequestMessage(); - msg.setId(uuid); - msg.setKey(key); - msg.setData(json.toString()); - resultHolder.invokeAllResult(msg); - } else { - logger.warn("设备预览/回放停止API调用失败!"); - RequestMessage msg = new RequestMessage(); - msg.setId(uuid); - msg.setKey(key); - msg.setData("streamId null"); - resultHolder.invokeAllResult(msg); + throw new ControllerException(ErrorCode.ERROR100.getCode(), "点播未找到"); } - // 超时处理 - result.onTimeout(()->{ - logger.warn(String.format("设备预览/回放停止超时,deviceId/channelId:%s_%s ", deviceId, channelId)); - redisCatchStorage.stopPlay(streamInfo); - storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId()); - RequestMessage msg = new RequestMessage(); - msg.setId(uuid); - msg.setKey(key); - msg.setData("Timeout"); - resultHolder.invokeAllResult(msg); - }); - return result; + cmder.streamByeCmd(deviceId, channelId, streamInfo.getStream(), null, null); + redisCatchStorage.stopPlay(streamInfo); + + storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId()); + JSONObject json = new JSONObject(); + json.put("deviceId", deviceId); + json.put("channelId", channelId); + return json; + } /** * 将不是h264的视频通过ffmpeg 转码为h264 + aac * @param streamId 流ID - * @return */ @Operation(summary = "将不是h264的视频通过ffmpeg 转码为h264 + aac") @Parameter(name = "streamId", description = "视频流ID", required = true) @@ -205,8 +164,6 @@ public class PlayController { /** * 结束转码 - * @param key - * @return */ @Operation(summary = "结束转码") @Parameter(name = "key", description = "视频流key", required = true) @@ -278,7 +235,7 @@ public class PlayController { }); result.onTimeout(() -> { - logger.warn(String.format("语音广播操作超时, 设备未返回应答指令")); + logger.warn("语音广播操作超时, 设备未返回应答指令"); RequestMessage msg = new RequestMessage(); msg.setKey(key); msg.setId(uuid); diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java index e9b9ef72..3ca63581 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java @@ -3,7 +3,6 @@ package com.genersoft.iot.vmp.vmanager.gb28181.playback; import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.conf.exception.ControllerException; import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; -import com.genersoft.iot.vmp.service.IMediaServerService; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.service.IPlayService; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; @@ -13,10 +12,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; import org.springframework.util.ObjectUtils; -import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -29,6 +25,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import org.springframework.web.context.request.async.DeferredResult; +/** + * @author lin + */ @Tag(name = "视频回放") @CrossOrigin @RestController @@ -65,11 +64,9 @@ public class PlaybackController { logger.debug(String.format("设备回放 API调用,deviceId:%s ,channelId:%s", deviceId, channelId)); } - DeferredResult result = playService.playBack(deviceId, channelId, startTime, endTime, null, wvpResult->{ - resultHolder.invokeResult(wvpResult.getData()); - }); - return result; + return playService.playBack(deviceId, channelId, startTime, endTime, null, + playBackResult->resultHolder.invokeResult(playBackResult.getData())); } @@ -109,10 +106,8 @@ public class PlaybackController { @GetMapping("/resume/{streamId}") public void playResume(@PathVariable String streamId) { logger.info("playResume: "+streamId); - JSONObject json = new JSONObject(); StreamInfo streamInfo = redisCatchStorage.queryPlayback(null, null, streamId, null); if (null == streamInfo) { - json.put("msg", "streamId不存在"); logger.warn("streamId不存在!"); throw new ControllerException(ErrorCode.ERROR400.getCode(), "streamId不存在"); } diff --git a/web_src/src/components/CloudRecordDetail.vue b/web_src/src/components/CloudRecordDetail.vue index db116e92..b96b6069 100644 --- a/web_src/src/components/CloudRecordDetail.vue +++ b/web_src/src/components/CloudRecordDetail.vue @@ -15,7 +15,6 @@ {{ item.substring(0,17)}} - @@ -392,7 +391,7 @@ endTime: moment(this.taskTimeRange[1]).format('YYYY-MM-DD HH:mm:ss'), } }).then(function (res) { - if (res.data.code === 0 && res.data.msg === "success") { + if (res.data.code === 0 ) { that.showTaskBox = false that.getTaskList(false); }else { @@ -414,7 +413,7 @@ isEnd: isEnd, } }).then(function (res) { - if (res.data.code == 0) { + if (res.data.code === 0) { if (isEnd){ that.taskListEnded = res.data.data; }else { diff --git a/web_src/src/components/ParentPlatformList.vue b/web_src/src/components/ParentPlatformList.vue index ae26497f..0cd517dd 100644 --- a/web_src/src/components/ParentPlatformList.vue +++ b/web_src/src/components/ParentPlatformList.vue @@ -127,8 +127,8 @@ export default { deletePlatformCommit: function(platform) { var that = this; that.$axios({ - method: 'delete', - url:`/api/platform/delete/${platform.serverGBId}` + method: 'delete', + url:`/api/platform/delete/${platform.serverGBId}` }).then(function (res) { if (res.data.code === 0) { that.$message({ diff --git a/web_src/src/components/PushVideoList.vue b/web_src/src/components/PushVideoList.vue index 9d8c51a7..6aed98a3 100644 --- a/web_src/src/components/PushVideoList.vue +++ b/web_src/src/components/PushVideoList.vue @@ -229,7 +229,7 @@ export default { streamId: row.stream } }).then((res) => { - if (res.data == "success") { + if (res.data.code === 0) { that.initData() } }).catch(function (error) { @@ -250,7 +250,7 @@ export default { url: "/api/push/remove_form_gb", data: row }).then((res) => { - if (res.data == "success") { + if (res.data.code === 0) { that.initData() } }).catch(function (error) { diff --git a/web_src/src/components/StreamProxyList.vue b/web_src/src/components/StreamProxyList.vue index f99f8e99..99b2226f 100644 --- a/web_src/src/components/StreamProxyList.vue +++ b/web_src/src/components/StreamProxyList.vue @@ -168,12 +168,14 @@ count: that.count } }).then(function (res) { - that.total = res.data.total; - for (let i = 0; i < res.data.list.length; i++) { - res.data.list[i]["startBtnLoading"] = false; + if (res.data.code === 0) { + that.total = res.data.data.total; + for (let i = 0; i < res.data.data.list.length; i++) { + res.data.data.list[i]["startBtnLoading"] = false; + } + that.streamProxyList = res.data.data.list; } - that.streamProxyList = res.data.list; - that.getListLoading = false; + that.getListLoading = false; }).catch(function (error) { console.log(error); that.getListLoading = false; @@ -190,7 +192,7 @@ url:`/api/onvif/search?timeout=3000`, }).then((res) =>{ this.getListLoading = false; - if (res.data.code == 0 ){ + if (res.data.code === 0 ){ if (res.data.data.length > 0) { this.$refs.onvifEdit.openDialog(res.data.data, (url)=>{ if (url != null) { @@ -277,7 +279,7 @@ }).then(function (res) { that.getListLoading = false; that.$set(row, 'startBtnLoading', false) - if (res.data == "success"){ + if (res.data.code === 0){ that.initData() }else { that.$message({ diff --git a/web_src/src/components/UserManager.vue b/web_src/src/components/UserManager.vue index 1048f539..c0fa695a 100644 --- a/web_src/src/components/UserManager.vue +++ b/web_src/src/components/UserManager.vue @@ -105,8 +105,10 @@ export default { count: that.count } }).then(function (res) { - that.total = res.data.total; - that.userList = res.data.list; + if (res.data.code === 0) { + that.total = res.data.data.total; + that.userList = res.data.data.list; + } that.getUserListLoading = false; }).catch(function (error) { that.getUserListLoading = false; diff --git a/web_src/src/components/channelList.vue b/web_src/src/components/channelList.vue index d8817d55..933cc443 100644 --- a/web_src/src/components/channelList.vue +++ b/web_src/src/components/channelList.vue @@ -342,12 +342,15 @@ export default { channelType: this.channelType } }).then( (res) =>{ - this.total = res.data.total; - this.deviceChannelList = res.data.list; - // 防止出现表格错位 - this.$nextTick(() => { - this.$refs.channelListTable.doLayout(); - }) + if (res.data.code === 0) { + this.total = res.data.data.total; + this.deviceChannelList = res.data.data.list; + // 防止出现表格错位 + this.$nextTick(() => { + this.$refs.channelListTable.doLayout(); + }) + } + }).catch(function (error) { console.log(error); }); @@ -361,12 +364,14 @@ export default { count: this.count, } }).then((res)=> { - this.total = res.data.total; - this.deviceChannelList = res.data.list; - // 防止出现表格错位 - this.$nextTick(() => { - this.$refs.channelListTable.doLayout(); - }) + if (res.data.code === 0) { + this.total = res.data.total; + this.deviceChannelList = res.data.list; + // 防止出现表格错位 + this.$nextTick(() => { + this.$refs.channelListTable.doLayout(); + }) + } }).catch(function (error) { console.log(error); }); diff --git a/web_src/src/components/common/ h265web.vue b/web_src/src/components/common/ h265web.vue new file mode 100644 index 00000000..4049721c --- /dev/null +++ b/web_src/src/components/common/ h265web.vue @@ -0,0 +1,327 @@ + + + + + diff --git a/web_src/src/components/control.vue b/web_src/src/components/control.vue index 2dd15ec5..722245bf 100644 --- a/web_src/src/components/control.vue +++ b/web_src/src/components/control.vue @@ -329,7 +329,7 @@ export default { method: 'get', url: '/zlm/' + that.mediaServerChoose + '/index/api/getThreadsLoad' }).then(function (res) { - if (res.data.code == 0) { + if (res.data.code === 0) { that.tableOption.xAxis.data.push(new Date().toLocaleTimeString('chinese', { hour12: false })); @@ -554,7 +554,7 @@ export default { url: '/zlm/' + that.mediaServerChoose + '/index/api/restartServer' }).then(function (res) { that.getAllSession(); - if (res.data.code == 0) { + if (res.data.code === 0) { that.$message({ type: 'success', message: '操作完成' diff --git a/web_src/src/components/dialog/StreamProxyEdit.vue b/web_src/src/components/dialog/StreamProxyEdit.vue index 77ee1d88..ac209db6 100644 --- a/web_src/src/components/dialog/StreamProxyEdit.vue +++ b/web_src/src/components/dialog/StreamProxyEdit.vue @@ -200,7 +200,7 @@ export default { method: 'get', url:`/api/platform/query/10000/1` }).then(function (res) { - that.platformList = res.data.list; + that.platformList = res.data.data.list; }).catch(function (error) { console.log(error); }); diff --git a/web_src/src/components/dialog/SyncChannelProgress.vue b/web_src/src/components/dialog/SyncChannelProgress.vue index 5506d83f..c972a46c 100644 --- a/web_src/src/components/dialog/SyncChannelProgress.vue +++ b/web_src/src/components/dialog/SyncChannelProgress.vue @@ -57,7 +57,7 @@ export default { method: 'get', url:`/api/device/query/${this.deviceId}/sync_status/`, }).then((res) => { - if (res.data.code == 0) { + if (res.data.code === 0) { if (!this.syncFlag) { this.syncFlag = true; } diff --git a/web_src/src/components/dialog/addUser.vue b/web_src/src/components/dialog/addUser.vue index 612c1e55..8dc56827 100644 --- a/web_src/src/components/dialog/addUser.vue +++ b/web_src/src/components/dialog/addUser.vue @@ -142,13 +142,8 @@ export default { url: "/api/role/all" }).then((res) => { this.loading = true; - console.info(res) - res.data - console.info(res.data.code) if (res.data.code === 0) { - console.info(res.data.data) this.options=res.data.data - } }).catch((error) => { console.error(error) diff --git a/web_src/src/components/dialog/catalogEdit.vue b/web_src/src/components/dialog/catalogEdit.vue index 11dbe4ea..e1cd8d26 100644 --- a/web_src/src/components/dialog/catalogEdit.vue +++ b/web_src/src/components/dialog/catalogEdit.vue @@ -118,8 +118,7 @@ export default { method:"post", url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`, data: this.form - }) - .then((res)=> { + }).then((res)=> { if (res.data.code === 0) { if (this.submitCallback)this.submitCallback(this.form) }else { diff --git a/web_src/src/components/dialog/changePassword.vue b/web_src/src/components/dialog/changePassword.vue index 23d761e1..77e1d2a8 100644 --- a/web_src/src/components/dialog/changePassword.vue +++ b/web_src/src/components/dialog/changePassword.vue @@ -96,7 +96,7 @@ export default { password: this.newPassword } }).then((res)=> { - if (res.data === "success"){ + if (res.data.code === 0) { this.$message({ showClose: true, message: '修改成功,请重新登录', diff --git a/web_src/src/components/dialog/changePasswordForAdmin.vue b/web_src/src/components/dialog/changePasswordForAdmin.vue index 0e0ae229..5b913577 100644 --- a/web_src/src/components/dialog/changePasswordForAdmin.vue +++ b/web_src/src/components/dialog/changePasswordForAdmin.vue @@ -91,7 +91,7 @@ export default { userId: this.form.id, } }).then((res)=> { - if (res.data === "success"){ + if (res.data.code === 0) { this.$message({ showClose: true, message: '修改成功', diff --git a/web_src/src/components/dialog/changePushKey.vue b/web_src/src/components/dialog/changePushKey.vue index 3efbf676..0b9834ef 100644 --- a/web_src/src/components/dialog/changePushKey.vue +++ b/web_src/src/components/dialog/changePushKey.vue @@ -71,8 +71,7 @@ export default { userId: this.form.id, } }).then((res)=> { - console.log(res.data) - if (res.data.msg === "success"){ + if (res.data.code === 0) { this.$message({ showClose: true, message: '修改成功', diff --git a/web_src/src/components/dialog/chooseChannel.vue b/web_src/src/components/dialog/chooseChannel.vue index cd8132a4..ad911e8c 100644 --- a/web_src/src/components/dialog/chooseChannel.vue +++ b/web_src/src/components/dialog/chooseChannel.vue @@ -101,7 +101,7 @@ export default { channelReduces: that.chooseData } }).then((res)=>{ - if (res.data == true) { + if (res.data.code === 0) { that.$message({ showClose: true, message: '保存成功,', diff --git a/web_src/src/components/dialog/chooseChannelForCatalog.vue b/web_src/src/components/dialog/chooseChannelForCatalog.vue index 86fb48d9..4303a2f5 100644 --- a/web_src/src/components/dialog/chooseChannelForCatalog.vue +++ b/web_src/src/components/dialog/chooseChannelForCatalog.vue @@ -87,8 +87,7 @@ export default { platformId: that.platformId, parentId: parentId } - }) - .then((res)=> { + }).then((res)=> { if (res.data.code === 0) { if (typeof(callback) === 'function') { callback(res.data.data) @@ -140,8 +139,7 @@ export default { id: id, platformId: this.platformId, } - }) - .then((res) => { + }).then((res) => { if (res.data.code === 0) { console.log("移除成功") node.parent.loaded = false @@ -163,8 +161,7 @@ export default { platformId: this.platformId, catalogId: id, } - }) - .then((res)=> { + }).then((res)=> { if (res.data.code === 0) { this.defaultCatalogIdSign = id; } diff --git a/web_src/src/components/dialog/chooseChannelForStream.vue b/web_src/src/components/dialog/chooseChannelForStream.vue index 1eec0b25..8d63dbf7 100644 --- a/web_src/src/components/dialog/chooseChannelForStream.vue +++ b/web_src/src/components/dialog/chooseChannelForStream.vue @@ -180,15 +180,17 @@ export default { } }) .then(function (res) { - that.total = res.data.total; - that.gbStreams = res.data.list; - that.gbChoosechannel = {}; - // 防止出现表格错位 - that.$nextTick(() => { + if (res.data.code === 0) { + that.total = res.data.data.total; + that.gbStreams = res.data.data.list; + that.gbChoosechannel = {}; + // 防止出现表格错位 + that.$nextTick(() => { that.$refs.gbStreamsTable.doLayout(); // 默认选中 - that.eventEnable = true; - }) + that.eventEnable = true; + }) + } }) .catch(function (error) { console.log(error); diff --git a/web_src/src/components/dialog/deviceEdit.vue b/web_src/src/components/dialog/deviceEdit.vue index 773e7c9e..12c0aa18 100644 --- a/web_src/src/components/dialog/deviceEdit.vue +++ b/web_src/src/components/dialog/deviceEdit.vue @@ -122,7 +122,7 @@ export default { params: this.form }).then((res) => { console.log(res.data) - if (res.data.code == 0) { + if (res.data.code === 0) { this.listChangeCallback() }else { this.$message({ diff --git a/web_src/src/components/dialog/devicePlayer.vue b/web_src/src/components/dialog/devicePlayer.vue index fac86efd..6e30cb41 100644 --- a/web_src/src/components/dialog/devicePlayer.vue +++ b/web_src/src/components/dialog/devicePlayer.vue @@ -438,6 +438,7 @@ export default { this.playFromStreamInfo(false, streamInfo) }, getUrlByStreamInfo(){ + console.log(this.streamInfo) if (location.protocol === "https:") { this.videoUrl = this.streamInfo[this.player[this.activePlayer][1]] }else { @@ -452,9 +453,9 @@ export default { this.$refs[this.activePlayer].pause() that.$axios({ method: 'post', - url: '/api/gb_record/convert/' + that.streamId + url: '/api/play/convert/' + that.streamId }).then(function (res) { - if (res.data.code == 0) { + if (res.data.code === 0) { that.convertKey = res.data.key; setTimeout(()=>{ that.isLoging = false; diff --git a/web_src/src/components/dialog/onvifEdit.vue b/web_src/src/components/dialog/onvifEdit.vue index c8532947..17eabb39 100644 --- a/web_src/src/components/dialog/onvifEdit.vue +++ b/web_src/src/components/dialog/onvifEdit.vue @@ -90,7 +90,7 @@ export default { } }).then((res) => { console.log(res.data) - if (res.data.code == 0) { + if (res.data.code === 0) { if (res.data.data != null) { this.listChangeCallback(res.data.data) }else { diff --git a/web_src/src/components/dialog/pushStreamEdit.vue b/web_src/src/components/dialog/pushStreamEdit.vue index bad50779..8c827a3d 100644 --- a/web_src/src/components/dialog/pushStreamEdit.vue +++ b/web_src/src/components/dialog/pushStreamEdit.vue @@ -112,7 +112,7 @@ export default { url:`/api/push/save_to_gb`, data: this.proxyParam }).then( (res) => { - if (res.data == "success") { + if (res.data.code === 0) { this.$message({ showClose: true, message: "保存成功", diff --git a/web_src/src/components/dialog/recordDownload.vue b/web_src/src/components/dialog/recordDownload.vue index c50e4ce1..b718a8bd 100644 --- a/web_src/src/components/dialog/recordDownload.vue +++ b/web_src/src/components/dialog/recordDownload.vue @@ -84,15 +84,16 @@ export default { method: 'get', url: `/api/gb_record/download/progress/${this.deviceId}/${this.channelId}/${this.stream}` }).then((res)=> { - console.log(res) - console.log(res.data.progress) - this.streamInfo = res.data; - if (parseFloat(res.data.progress) == 1) { - this.percentage = 100; - }else { - this.percentage = (res.data.progress*100).toFixed(1); + if (res.data.code === 0) { + this.streamInfo = res.data.data; + if (parseFloat(res.data.progress) == 1) { + this.percentage = 100; + }else { + this.percentage = (res.data.progress*100).toFixed(1); + } + if (callback)callback(); } - if (callback)callback(); + }).catch((e) =>{ }); @@ -140,7 +141,7 @@ export default { endTime: null, } }).then((res) =>{ - if (res.data.code === 0 && res.data.msg === "success") { + if (res.data.code === 0 ) { // 查询进度 this.title = "录像文件处理中..." this.taskId = res.data.data; @@ -173,7 +174,7 @@ export default { } }).then((res) => { console.log(res) - if (res.data.code == 0) { + if (res.data.code === 0) { this.percentage = parseFloat(res.data.data.percentage)*100 if (res.data.data[0].percentage === '1') { this.getProgressForFileRun = false; diff --git a/web_src/src/components/live.vue b/web_src/src/components/live.vue index 12bbf546..c2c09f4c 100644 --- a/web_src/src/components/live.vue +++ b/web_src/src/components/live.vue @@ -137,9 +137,6 @@ export default { method: 'get', url: '/api/play/start/' + deviceId + '/' + channelId }).then(function (res) { - // that.isLoging = false; - console.log('=====----=====') - console.log(res) if (res.data.code === 0 && res.data.data) { itemData.playUrl = res.data.data.httpsFlv that.setPlayUrl(res.data.data.ws_flv, idxTmp) diff --git a/web_src/src/components/map.vue b/web_src/src/components/map.vue index bfd4c1f6..2aa17f63 100644 --- a/web_src/src/components/map.vue +++ b/web_src/src/components/map.vue @@ -302,7 +302,6 @@ export default { }).then(function (res) { that.isLoging = false; if (res.data.code === 0) { - that.$refs.devicePlayer.openDialog("media", deviceId, channelId, { streamInfo: res.data.data, hasAudio: channel.hasAudio diff --git a/web_src/src/components/service/DeviceService.js b/web_src/src/components/service/DeviceService.js index 45d4ac23..85d36f8b 100644 --- a/web_src/src/components/service/DeviceService.js +++ b/web_src/src/components/service/DeviceService.js @@ -43,10 +43,10 @@ class DeviceService{ getAllDeviceListIteration(deviceList, currentPage, count, callback, endCallback, errorCallback) { this.getDeviceList(currentPage, count, (data) => { - if (data.list) { - if (typeof (callback) == "function") callback(data.list) - deviceList = deviceList.concat(data.list); - if (deviceList.length < data.total) { + if (data.code === 0 && data.data.list) { + if (typeof (callback) == "function") callback(data.data.list) + deviceList = deviceList.concat(data.data.list); + if (deviceList.length < data.data.total) { currentPage ++ this.getAllDeviceListIteration(deviceList, currentPage, count, callback, endCallback, errorCallback) }else { @@ -134,10 +134,6 @@ class DeviceService{ }).catch(errorCallback); } - getTree(deviceId, id, param3, param4) { - - } - getTree(deviceId, parentId, onlyCatalog, callback, endCallback, errorCallback) { let currentPage = 1; let count = 100; @@ -147,10 +143,10 @@ class DeviceService{ getTreeIteration(deviceId, parentId, onlyCatalog, catalogList, currentPage, count, callback, endCallback, errorCallback) { this.getTreeInfo(deviceId, parentId, onlyCatalog, currentPage, count, (data) => { - if (data.list) { - if (typeof (callback) == "function") callback(data.list) - catalogList = catalogList.concat(data.list); - if (catalogList.length < data.total) { + if (data.code === 0 && data.data.list) { + if (typeof (callback) == "function") callback(data.data.list) + catalogList = catalogList.concat(data.data.list); + if (catalogList.length < data.data.total) { currentPage ++ this.getTreeIteration(deviceId, parentId, onlyCatalog, catalogList, currentPage, count, callback, endCallback, errorCallback) }else {