瀏覽代碼

修复云端录像界面

648540858 2 年之前
父節點
當前提交
58d1f0ea16

+ 7 - 0
src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java

@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.conf;
 
 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
 import com.genersoft.iot.vmp.service.IMediaServerService;
+import org.apache.catalina.connector.ClientAbortException;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
@@ -193,6 +194,12 @@ public class ProxyServletConfig {
             } catch (IOException ioException) {
                 if (ioException instanceof ConnectException) {
                     logger.error("录像服务 连接失败");
+                }else if (ioException instanceof ClientAbortException) {
+                    /**
+                     * TODO 使用这个代理库实现代理在遇到代理视频文件时,如果是206结果,会遇到报错蛋市目前功能正常,
+                     * TODO 暂时去除异常处理。后续使用其他代理框架修改测试
+                     */
+
                 }else {
                     logger.error("录像服务 代理失败: ", e);
                 }

+ 3 - 1
src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java

@@ -84,6 +84,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
         matchers.add("/v3/api-docs/**");
         matchers.add("/js/**");
         matchers.add("/api/device/query/snap/**");
+        matchers.add("/record_proxy/*/**");
+        matchers.add("/zlm_Proxy/FhTuMYqB2HeCuNOb/record/t/1/2023-03-25/16:35:07-16:35:16-9353.mp4");
         matchers.addAll(userSetting.getInterfaceAuthenticationExcludes());
         // 可以直接访问的静态数据
         web.ignoring().antMatchers(matchers.toArray(new String[0]));
@@ -119,7 +121,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 .authorizeRequests()
                 .requestMatchers(CorsUtils::isPreFlightRequest).permitAll()
                 .antMatchers(userSetting.getInterfaceAuthenticationExcludes().toArray(new String[0])).permitAll()
-                .antMatchers("/api/user/login","/index/hook/**").permitAll()
+                .antMatchers("/api/user/login","/index/hook/**","/zlm_Proxy/FhTuMYqB2HeCuNOb/record/t/1/2023-03-25/16:35:07-16:35:16-9353.mp4").permitAll()
                 .anyRequest().authenticated()
                 // 异常处理器
                 .and()

+ 6 - 1
web_src/src/components/CloudRecordDetail.vue

@@ -220,14 +220,18 @@
         }
         this.queryRecordDetails(()=>{
           if (this.detailFiles.length > 0){
+            console.log(this.detailFiles)
             let timeForFile = this.getTimeForFile(this.detailFiles[0]);
             let lastTimeForFile = this.getTimeForFile(this.detailFiles[this.detailFiles.length - 1]);
             let timeNum = timeForFile[0].getTime() - new Date(this.chooseDate + " " + this.timeFormat).getTime()
+            console.log(timeNum)
             let lastTimeNum = lastTimeForFile[1].getTime() - new Date(this.chooseDate + " " + this.timeFormat).getTime()
 
             this.playTime = parseInt(timeNum/1000)
             this.sliderMIn = parseInt(timeNum/1000 - timeNum/1000%(60*60))
+            console.log(this.sliderMIn )
             this.sliderMax = parseInt(lastTimeNum/1000 - lastTimeNum/1000%(60*60)) + 60*60
+            console.log(this.sliderMax )
           }
         });
       },
@@ -311,11 +315,12 @@
         }
       },
       getTimeForFile(file){
+        console.log(file)
         let timeStr = file.substring(0,17);
         if(timeStr.indexOf("~") > 0){
           timeStr = timeStr.replaceAll("-",":")
         }
-        let timeArr = timeStr.split("~");
+        let timeArr = timeStr.split("-");
         let starTime = new Date(this.chooseDate + " " + timeArr[0]);
         let endTime = new Date(this.chooseDate + " " + timeArr[1]);
         if(this.checkIsOver24h(starTime,endTime)){