소스 검색

云展播时间限制

吴志根 3 년 전
부모
커밋
da59c8ba36
2개의 변경된 파일9개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 1
      src/dsb/com/cnd3b/common/Controller.java
  2. 8 4
      src/dsb/com/cnd3b/restcontroller/publicmethod/live/live.java

+ 1 - 1
src/dsb/com/cnd3b/common/Controller.java

@@ -841,7 +841,7 @@ public class Controller extends BaseClass {
     }
 
     public long getTimestamp(String time) {
-        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
         Date date = null;
         try {

+ 8 - 4
src/dsb/com/cnd3b/restcontroller/publicmethod/live/live.java

@@ -84,12 +84,16 @@ public class live extends Controller {
                     newliverows.add(liverows.get(i));
                 }
             }
-
             //ÏÞÖÆÔÚ2022-03-17£¬2022-03-19
-            Long timeStart = getTimestamp("2022-03-17");
-            Long timeEnd = getTimestamp("2022-03-19");
+            Long time1 = getTimestamp("2022-03-17 19:30:00");
+            Long time2 = getTimestamp("2022-03-18 19:30:00");
+            Long time3 = getTimestamp("2022-03-19 19:30:00");
+            Long timeEnd = getTimestamp("2022-03-20 00:00:00");
             Long timeNow = System.currentTimeMillis();
-            if (timeNow >= timeStart && timeNow <= timeEnd) {
+            System.err.println(time1);
+            long hour = 3600000;
+            System.err.println(time2+hour);
+            if ((timeNow >= time1 && timeNow <= time1 + hour) || (timeNow >= time2 && timeNow <= time2 + hour) || (timeNow >= time3 && timeNow <= time3 + hour) || (timeNow >= timeEnd)) {
                 resultObject.put("tlivelist", newliverows);
             } else {
                 resultObject.put("tlivelist", new Rows());