|
@@ -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();
|