diff --git a/source/application/common/logic/PassFlow.php b/source/application/common/logic/PassFlow.php index 3419ec7..cb5514b 100644 --- a/source/application/common/logic/PassFlow.php +++ b/source/application/common/logic/PassFlow.php @@ -116,7 +116,7 @@ class PassFlow $groupsData = []; $dkey=[]; if ($date_str == 'H:00') { - $hour = (int) date('H'); + $hour = (int) date('H'); for ($i = 0; $i <= $hour; $i++) { $str = strlen($i) == 1 ? '0'.$i.':00' : $i.':00'; $allTimeData[$str]['num'] = 0; @@ -142,6 +142,7 @@ class PassFlow $dkey[]=$str; } } + # 体育 + 博物馆客流柱状图数据 $sumNoRepeatInNum = 0; $groupsIdArr = []; foreach ($list as $value) { @@ -156,6 +157,7 @@ class PassFlow ksort($allTimeData); $groupsIdParamArr = []; + # 总览-合并文化数据 if (empty($groupsId)) { $res = $dm->select('bt_library',['group_id' => ['baz001','BAF055']]); foreach ($res as $row) { @@ -170,6 +172,20 @@ class PassFlow $groupsData[$row['group_name']]['noRepeatInNum'] = $row['year_incount']; } } + $whgData = []; + if ($date_str == 'H:00') { + $whgData = $dm->select('bt_library_hours',['create_time' => ['>=',date("Y-m-d 00:00:00")],'group_id' => 'lib001']); + } elseif ($date_str == 'd') { + $whgData = $dm->select('bt_library_data',['create_time' => ['>=',date("Y-m-01 00:00:00")],'group_id' => 'lib001','date' => 'day']); + } elseif ($date_str == 'm') { + $whgData = $dm->select('bt_library_data',['create_time' => ['>=',date("Y-01-01 00:00:00")],'group_id' => 'lib001','date' => 'month']); + } + # 文化馆客流柱状图数据 + foreach ($whgData as $whgRow) { + $date = date($date_str,strtotime($whgRow['create_time'])); // 各时间端进馆人数 + if (!isset($allTimeData[$date])) continue; + $allTimeData[$date]['num'] += $whgRow['incount']; + } } else { $groupsIdParamArr = explode("|",$groupsId); } @@ -482,7 +498,8 @@ class PassFlow $sumAllFind = $dm->find('bt_passenger_flow_all', $sumAllWhere,'SUM("flowInNum") as NUM'); $sum_all_incount += isset($sumAllFind['NUM']) ? $sumAllFind['NUM'] : 0; # 累计进馆人数 - 文化、图书 - $sum_all_incount += $ts_year_incount + $wh_year_incount; + $libData = $dm->find('bt_library_data',['group_id' => 'lib001','date' => 'year'],' SUM("incount") as SUM'); + $sum_all_incount += $libData ? $libData['SUM'] : 0; $data = [ 'month' => [ @@ -614,14 +631,14 @@ class PassFlow if (!isset($returnData[$str])) $returnData[$str] = 0; } foreach ($list as $value) { - $date = date('H:00',strtotime($value['statTime'])); // 各时间端进馆人数 + $date = date('H:00',ceil($value['createTime'] / 1000)); // 各时间端进馆人数 if (!isset($allTimeData[$date])) continue; $returnData[$date] += $value['flowInNum']; } # 图书、文化馆 $start_create_time = date("Y-m-d H:00:00",strtotime('-23 hours')); $end_create_time = date("Y-m-d H:59:59"); - $hoursWhere = ' "group_id" = ' . "'lib001'" . ' and "create_time" >= ' . "'{$start_create_time}'" + $hoursWhere = ' "group_id" in (' . "'lib001','BAF055')" . ' and "create_time" >= ' . "'{$start_create_time}'" . ' and "create_time" <= ' . "'{$end_create_time}'" ; $hoursRes = $dm->select('bt_library_hours',$hoursWhere); foreach ($hoursRes as $hoursRow) {