|
|
|
@ -261,19 +261,19 @@ class PassFlow |
|
|
|
$sumFind = $dm->find('bt_passenger_flow_all', $sumWhere,'SUM("flowInNum") as NUM'); |
|
|
|
$returnData['sumYear']['noRepeatInNum'] = isset($sumFind['NUM']) ? $sumFind['NUM'] : 0; |
|
|
|
|
|
|
|
if (empty($groupsId)) { |
|
|
|
# 文化数据 |
|
|
|
$mData = $dm->find('bt_library',['group_id' => 'lib001']); |
|
|
|
if (empty($groupsId)) { |
|
|
|
# 文化数据 |
|
|
|
$mData = $dm->find('bt_library',['group_id' => 'lib001']); |
|
|
|
$returnData['day']['noRepeatInNum'] += isset($mData['today_incount']) ? $mData['today_incount'] : 0; |
|
|
|
$returnData['month']['noRepeatInNum'] += isset($mData['month_incount']) ? $mData['month_incount'] : 0; |
|
|
|
$returnData['year']['noRepeatInNum'] += isset($mData['year_incount']) ? $mData['year_incount'] : 0; |
|
|
|
$returnData['sumYear']['noRepeatInNum'] += isset($mData['year_incount']) ? $mData['year_incount'] : 0; |
|
|
|
$week_start = date("Y-m-d 00:00:00",strtotime('this week')); |
|
|
|
$week_end = date("Y-m-d 23:59:59",strtotime("-".(date("w") - 7) . "day")); |
|
|
|
$weekDateWhere = ' "group_id" =' . "'lib001'" . ' and "create_time" >= ' . "'{$week_start}'" . ' and "create_time" <= ' . "'{$week_end}'"; |
|
|
|
$weekDate = $dm->find('bt_library_hours',$weekDateWhere,'SUM("incount") as NUM'); |
|
|
|
$returnData['week']['noRepeatInNum'] += isset($weekDate['NUM']) ? $weekDate['NUM'] : 0; |
|
|
|
} |
|
|
|
$returnData['sumYear']['noRepeatInNum'] += isset($mData['year_incount']) ? $mData['year_incount'] : 0; |
|
|
|
$week_start = date("Y-m-d 00:00:00",strtotime('this week')); |
|
|
|
$week_end = date("Y-m-d 23:59:59",strtotime("-".(date("w") - 7) . "day")); |
|
|
|
$weekDateWhere = ' "group_id" =' . "'lib001'" . ' and "create_time" >= ' . "'{$week_start}'" . ' and "create_time" <= ' . "'{$week_end}'"; |
|
|
|
$weekDate = $dm->find('bt_library_hours',$weekDateWhere,'SUM("incount") as NUM'); |
|
|
|
$returnData['week']['noRepeatInNum'] += isset($weekDate['NUM']) ? $weekDate['NUM'] : 0; |
|
|
|
} |
|
|
|
foreach ($returnData as &$val) { |
|
|
|
$val['noRepeatInNum'] = formatNumber($val['noRepeatInNum']); |
|
|
|
} |
|
|
|
@ -446,37 +446,43 @@ class PassFlow |
|
|
|
# 累计进馆人数 |
|
|
|
$sum_all_incount = 0; |
|
|
|
# 宝安图书馆数据 |
|
|
|
$res = $dm->find('bt_library',['group_id' => 'lib001']); |
|
|
|
$sum_month_incount = $month_incount = isset($res['month_incount']) ? $res['month_incount'] : 0; |
|
|
|
$sum_today_incount = $today_incount = isset($res['today_incount']) ? $res['today_incount'] : 0; |
|
|
|
$sum_all_incount += $sum_year_incount = $year_incount = isset($res['year_incount']) ? $res['year_incount'] : 0; |
|
|
|
$ts_res = $dm->find('bt_library',['group_id' => 'baz001']); |
|
|
|
$ts_today_incount = isset($ts_res['today_incount']) ? $ts_res['today_incount'] : 0; |
|
|
|
$ts_month_incount = isset($ts_res['month_incount']) ? $ts_res['month_incount'] : 0; |
|
|
|
$ts_year_incount = isset($ts_res['year_incount']) ? $ts_res['year_incount'] : 0; |
|
|
|
|
|
|
|
# 劳务博物馆数据 |
|
|
|
$dateArr = ['day' => 'daily', 'month' => 'monthly', 'year' => 'yearly']; |
|
|
|
$dateData = self::getDateData(); |
|
|
|
$museumData = []; |
|
|
|
$bw_data = []; |
|
|
|
foreach ($dateArr as $date => $granularity) { |
|
|
|
|
|
|
|
$museumWhere = ' "groupId"='."'510'".' and "granularity" = ' . "'{$granularity}'" . ' and "date" = ' . "'{$date}'"; |
|
|
|
$museumWhere .= ' and "statTime" >= ' . "'{$dateData[$date]['start_time']}'" . ' and "statTime" <= ' . "'{$dateData[$date]['end_time']}'"; |
|
|
|
$museumRes = $dm->find('bt_passenger_flow_all',$museumWhere,' SUM("noRepeatInNum") as NUM'); |
|
|
|
$museumData[$date] = $museumRes['NUM'] ?: 0; |
|
|
|
$bw_data[$date] = $museumRes['NUM'] ?: 0; |
|
|
|
} |
|
|
|
$museum_today_incount = isset($museumData['day']) ? $museumData['day'] : 0; |
|
|
|
$sum_today_incount += $museum_today_incount; |
|
|
|
$museum_month_incount = isset($museumData['month']) ? $museumData['month'] : 0; |
|
|
|
$sum_month_incount += $museum_month_incount; |
|
|
|
$museum_year_incount = isset($museumData['year']) ? $museumData['year'] : 0; |
|
|
|
$sum_year_incount += $museum_year_incount; |
|
|
|
$bw_today_incount = isset($bw_data['day']) ? $bw_data['day'] : 0; |
|
|
|
$bw_month_incount = isset($bw_data['month']) ? $bw_data['month'] : 0; |
|
|
|
$bw_year_incount = isset($bw_data['year']) ? $bw_data['year'] : 0; |
|
|
|
|
|
|
|
# 文化馆 |
|
|
|
$res = $dm->find('bt_library',['group_id' => 'BAF055']); |
|
|
|
$culture_today_count = isset($res['today_incount']) ? $res['today_incount'] : 0; |
|
|
|
# 文化馆数据 |
|
|
|
$wh_res = $dm->find('bt_library',['group_id' => 'BAF055']); |
|
|
|
$wh_today_incount = isset($wh_res['today_incount']) ? $wh_res['today_incount'] : 0; |
|
|
|
$wh_month_incount = isset($wh_res['month_incount']) ? $wh_res['month_incount'] : 0; |
|
|
|
$wh_year_incount = isset($wh_res['year_incount']) ? $wh_res['year_incount'] : 0; |
|
|
|
|
|
|
|
# 累计进馆人数 |
|
|
|
# 总年、月、日总数 |
|
|
|
$sum_today_incount = $ts_today_incount + $bw_today_incount + $wh_today_incount; |
|
|
|
$sum_month_incount = $ts_month_incount + $bw_month_incount + $wh_month_incount; |
|
|
|
$sum_year_incount = $ts_year_incount + $bw_year_incount + $wh_year_incount; |
|
|
|
|
|
|
|
# 累计进馆人数 - 博物馆 |
|
|
|
$sumAllWhere = ' "granularity" = ' . "'yearly'" . ' and "date" = ' . "'year' " . ' and "groupId"='."'510'"; |
|
|
|
$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; |
|
|
|
|
|
|
|
$data = [ |
|
|
|
'month' => [ |
|
|
|
@ -494,15 +500,15 @@ class PassFlow |
|
|
|
'hour24' => [ |
|
|
|
[ |
|
|
|
'groupName' => '图书馆', |
|
|
|
'incount' => $today_incount |
|
|
|
'incount' => $ts_today_incount |
|
|
|
], |
|
|
|
[ |
|
|
|
'groupName' => '博物馆', |
|
|
|
'incount' => $museum_today_incount |
|
|
|
'incount' => $bw_today_incount |
|
|
|
], |
|
|
|
[ |
|
|
|
'groupName' => '文化馆', |
|
|
|
'incount' => $culture_today_count |
|
|
|
'incount' => $wh_today_incount |
|
|
|
], |
|
|
|
] |
|
|
|
]; |
|
|
|
@ -646,12 +652,12 @@ class PassFlow |
|
|
|
if (empty($dm)) $dm = new Dm(); |
|
|
|
|
|
|
|
# 获取文化组id |
|
|
|
if ($is_group) { |
|
|
|
$groupRes = $dm->select('bt_passenger_monitor_group',['type' => 2],'"groupId","groupName"'); |
|
|
|
$groupsId = []; |
|
|
|
foreach ($groupRes as $groupRow) $groupsId[] = $groupRow['groupId']; |
|
|
|
$data = self::toDayGroupsEnterNum($dm,['groupsId' => implode("|",$groupsId)]); |
|
|
|
} |
|
|
|
if ($is_group) { |
|
|
|
$groupRes = $dm->select('bt_passenger_monitor_group',['type' => 2],'"groupId","groupName"'); |
|
|
|
$groupsId = []; |
|
|
|
foreach ($groupRes as $groupRow) $groupsId[] = $groupRow['groupId']; |
|
|
|
$data = self::toDayGroupsEnterNum($dm,['groupsId' => implode("|",$groupsId)]); |
|
|
|
} |
|
|
|
# 图书、文化馆 |
|
|
|
$start_create_time = date("Y-m-d 00:00:00"); |
|
|
|
$end_create_time = date("Y-m-d 23:59:59"); |
|
|
|
|