Showing
4 changed files
with
46 additions
and
9 deletions
@@ -82,4 +82,13 @@ public class UfoLiveController { | @@ -82,4 +82,13 @@ public class UfoLiveController { | ||
82 | 82 | ||
83 | return new ApiResponse.ApiResponseBuilder().code(200).data(initCameraCode).message("查询成功").build(); | 83 | return new ApiResponse.ApiResponseBuilder().code(200).data(initCameraCode).message("查询成功").build(); |
84 | } | 84 | } |
85 | + | ||
86 | + @RequestMapping(value = "/queryCurrentTime") | ||
87 | + public ApiResponse queryCurrentTime() { | ||
88 | + LOGGER.info("queryCurrentTime method in."); | ||
89 | + | ||
90 | + Integer currentTime = ufoLiveService.queryCurrentTime(); | ||
91 | + | ||
92 | + return new ApiResponse.ApiResponseBuilder().code(200).data(currentTime).message("获取时间成功").build(); | ||
93 | + } | ||
85 | } | 94 | } |
@@ -150,4 +150,8 @@ public class UfoLiveService implements ApplicationContextAware { | @@ -150,4 +150,8 @@ public class UfoLiveService implements ApplicationContextAware { | ||
150 | UserCameraRecord userCameraRecord = userCameraRecordMapper.selectUserCameraRecord(new UserHelper().getUserId()); | 150 | UserCameraRecord userCameraRecord = userCameraRecordMapper.selectUserCameraRecord(new UserHelper().getUserId()); |
151 | return null == userCameraRecord ? null : userCameraRecord.getCameraCode(); | 151 | return null == userCameraRecord ? null : userCameraRecord.getCameraCode(); |
152 | } | 152 | } |
153 | + | ||
154 | + public Integer queryCurrentTime() { | ||
155 | + return DateUtil.getCurrentTimeSeconds(); | ||
156 | + } | ||
153 | } | 157 | } |
@@ -723,16 +723,41 @@ function addRecordPage(skup, order_code, id) { | @@ -723,16 +723,41 @@ function addRecordPage(skup, order_code, id) { | ||
723 | return; | 723 | return; |
724 | } | 724 | } |
725 | 725 | ||
726 | - | 726 | + $('#startTime').val(parseInt(new Date().getTime() / 1000)); |
727 | timedCount(); | 727 | timedCount(); |
728 | $('#recordBtn').linkbutton({text:'结束录制'}); | 728 | $('#recordBtn').linkbutton({text:'结束录制'}); |
729 | - $('#startTime').val(parseInt(new Date().getTime() / 1000)); | ||
730 | - //$("#startTime").textbox('setValue',parseInt(new Date().getTime() / 1000)); | 729 | + |
730 | + $.ajax({ | ||
731 | + contentType: "application/json", | ||
732 | + dataType: "json", | ||
733 | + type: "GET", | ||
734 | + url: contextPath + '/live/queryCurrentTime', | ||
735 | + success: function (data) { | ||
736 | + if (data.code != 200) { | ||
737 | + $('#startTime').val(parseInt(new Date().getTime() / 1000)); | ||
738 | + } else if (data.data){ | ||
739 | + $('#startTime').val(data.data); | ||
740 | + } | ||
741 | + } | ||
742 | + }); | ||
743 | + | ||
731 | } else if ($('#endTime').val() == '') { | 744 | } else if ($('#endTime').val() == '') { |
732 | $('#endTime').val(parseInt(new Date().getTime() / 1000)); | 745 | $('#endTime').val(parseInt(new Date().getTime() / 1000)); |
733 | stopCount(); | 746 | stopCount(); |
734 | - // $("#endTime").textbox('setValue',parseInt(new Date().getTime() / 1000)); | ||
735 | $('#recordBtn').linkbutton({text:'上传云端'}); | 747 | $('#recordBtn').linkbutton({text:'上传云端'}); |
748 | + $.ajax({ | ||
749 | + contentType: "application/json", | ||
750 | + dataType: "json", | ||
751 | + type: "GET", | ||
752 | + url: contextPath + '/live/queryCurrentTime', | ||
753 | + success: function (data) { | ||
754 | + if (data.code != 200) { | ||
755 | + $('#endTime').val(parseInt(new Date().getTime() / 1000)); | ||
756 | + } else if (data.data){ | ||
757 | + $('#endTime').val(data.data); | ||
758 | + } | ||
759 | + } | ||
760 | + }); | ||
736 | } else if ($('#startTime').val() != '' && $('#endTime').val() != ''){ | 761 | } else if ($('#startTime').val() != '' && $('#endTime').val() != ''){ |
737 | $('#recordBtn').linkbutton('disable'); | 762 | $('#recordBtn').linkbutton('disable'); |
738 | $.post(contextPath + "/live/generateMp4", { | 763 | $.post(contextPath + "/live/generateMp4", { |
@@ -37,11 +37,10 @@ | @@ -37,11 +37,10 @@ | ||
37 | var totalVar; | 37 | var totalVar; |
38 | 38 | ||
39 | function stopCount() { | 39 | function stopCount() { |
40 | - var endTime = parseInt($('#endTime').val()); | ||
41 | - var startTime = parseInt($('#startTime').val()); | ||
42 | - var secondVar = parseInt((endTime - startTime) % 60); | ||
43 | - if (endTime - startTime > 60) { | ||
44 | - var minuteVar = parseInt((endTime - startTime) / 60); | 40 | + var totalTime = parseInt($('#txt').val()); |
41 | + var secondVar = parseInt(totalTime % 60); | ||
42 | + if (totalTime > 60) { | ||
43 | + var minuteVar = parseInt(totalTime / 60); | ||
45 | totalVar = minuteVar + '分' + secondVar + '秒'; | 44 | totalVar = minuteVar + '分' + secondVar + '秒'; |
46 | } else { | 45 | } else { |
47 | totalVar = secondVar + '秒'; | 46 | totalVar = secondVar + '秒'; |
-
Please register or login to post a comment