cyzhao 3 år sedan
förälder
incheckning
53e1d1a196
1 ändrade filer med 13 tillägg och 2 borttagningar
  1. 13 2
      Gameserver/Public/gamesys/app/providers/GameContinuedTs.php

+ 13 - 2
Gameserver/Public/gamesys/app/providers/GameContinuedTs.php

@@ -21,7 +21,7 @@ $lastItem = null;
 $dic = new stdClass();
 $list = array();
 $index = 1;
-
+$num = 0;
 foreach ($arr as $item) {
     if ($lastItem != null) {
         $list[] = $lastItem;
@@ -38,8 +38,19 @@ foreach ($arr as $item) {
             $list = array();
         }
     }
-
+    $num+=1;
     $lastItem = $item;
+    if(count($arr)==$num){
+        $list[] = $item;
+        
+        $timeDic = new stdClass();
+        $timeDic->startTs = strtotime($list[0]->ts);
+        $timeDic->endTs = strtotime($list[count($list) - 1]->ts);
+        $timeDic->durationTs = strtotime($list[count($list) - 1]->ts) - strtotime($list[0]->ts);
+
+        $dic->$index = $timeDic;     
+        break;
+    }
 }
 
 $result = new stdClass();