|
|
|
@ -46,7 +46,7 @@ class PassFlow |
|
|
|
{ |
|
|
|
|
|
|
|
$granularity = $param['granularity']; |
|
|
|
$type = isset($param['type']) ?$param['type']:''; |
|
|
|
$type = isset($param['type'])?$param['type']:''; |
|
|
|
|
|
|
|
if (empty($granularity)) return ['code' => 0, 'msg' => '缺少参数:granularity']; |
|
|
|
if (!in_array($granularity,self::$granularity)) return ['code' => 0, 'msg' => '参数错误:granularity']; |
|
|
|
@ -148,7 +148,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; |
|
|
|
@ -311,7 +311,8 @@ class PassFlow |
|
|
|
} |
|
|
|
|
|
|
|
#累计进馆人数 |
|
|
|
$sumWhere = ' "granularity" = ' . "'yearly'" . ' and "date" = ' . "'year' {$paramWhere}"; |
|
|
|
$sumWhere = ' "granularity" = ' . "'yearly'" . ' and "date" = ' . "'year' {$paramWhere}" |
|
|
|
. ' and "statTime" >= ' . "'{$dateData['year']['start_time']}'" . ' and "statTime" <= ' . "'{$dateData['year']['end_time']}'"; |
|
|
|
$sumFind = $dm->find('bt_passenger_flow_all', $sumWhere,'SUM("flowInNum") as NUM'); |
|
|
|
$returnData['sumYear']['noRepeatInNum'] = isset($sumFind['NUM']) ? $sumFind['NUM'] : 0; |
|
|
|
|
|
|
|
@ -320,11 +321,18 @@ class PassFlow |
|
|
|
$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['year']['noRepeatInNum'] += isset($mData['year_incount']) ? $mData['year_incount'] : 0; |
|
|
|
|
|
|
|
$start = date("Y-01-01 00:00:00",time()); |
|
|
|
$end = date("Y-12-31 23:59:59",time()); |
|
|
|
$libraryDataYearWhere = ' "date" = ' . "'year'" . ' and "group_id" = ' . "'lib001'" . ' and "create_time" >= ' . "'{$start}'" . ' and "create_time" <= ' . "'{$end}'"; |
|
|
|
$libraryDataYear = $dm->find('bt_library_data',$libraryDataYearWhere); |
|
|
|
$returnData['year']['noRepeatInNum'] += isset($libraryDataYear['incount']) ? $libraryDataYear['incount'] : 0; |
|
|
|
|
|
|
|
// $returnData['sumYear']['noRepeatInNum'] += isset($mData['year_incount']) ? $mData['year_incount'] : 0; |
|
|
|
# 文化总年度 |
|
|
|
$libraryData = $dm->find('bt_library_data',['group_id' => 'lib001','date' => 'year'],'SUM("incount") as NUM'); |
|
|
|
$returnData['sumYear']['noRepeatInNum'] += isset($libraryData['NUM']) ? $libraryData['NUM'] : 0; |
|
|
|
# $libraryData = $dm->find('bt_library_data',['group_id' => 'lib001','date' => 'year'],'SUM("incount") as NUM'); |
|
|
|
$returnData['sumYear']['noRepeatInNum'] += isset($libraryDataYear['incount']) ? $libraryDataYear['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}'"; |
|
|
|
@ -348,7 +356,7 @@ class PassFlow |
|
|
|
public static function realTimeData($dm = null) |
|
|
|
{ |
|
|
|
if (empty($dm)) $dm = new Dm(); |
|
|
|
|
|
|
|
|
|
|
|
$list = $dm->select('bt_passenger_flow_real'); |
|
|
|
$data = []; |
|
|
|
|
|
|
|
@ -365,6 +373,7 @@ class PassFlow |
|
|
|
|
|
|
|
$returnData = []; |
|
|
|
foreach ($data as $groupId => $val) { |
|
|
|
if (!isset($groupThreshold[$groupId])) continue; |
|
|
|
$threshold = $groupThreshold[$groupId]; |
|
|
|
if (is_array($threshold)) { |
|
|
|
$interval = self::getIntervalType($val['holdValue'],$threshold['min'],$threshold['max']); |
|
|
|
@ -382,6 +391,7 @@ class PassFlow |
|
|
|
$val['sort']=intval($getGroup['sort']); |
|
|
|
$returnData[] = $val; |
|
|
|
} |
|
|
|
|
|
|
|
$libData = $dm->select('bt_library',['group_id' => ['baz001','BAF055']]); |
|
|
|
foreach ($libData as $libRow) { |
|
|
|
$holdValue = abs($libRow['today_incount'] - $libRow['today_outcount']); |
|
|
|
@ -513,12 +523,22 @@ class PassFlow |
|
|
|
'list' => $listData |
|
|
|
]; |
|
|
|
} |
|
|
|
if(empty($groupsId)){ |
|
|
|
$data = self::getLibraryGroupHoursList($dm,false,$data); |
|
|
|
} |
|
|
|
if(empty($groupsId)){ |
|
|
|
$data = self::getLibraryGroupHoursList($dm,false,$data); |
|
|
|
} |
|
|
|
return $data; |
|
|
|
} |
|
|
|
|
|
|
|
protected static function getWhYearData($dm,$group_id) |
|
|
|
{ |
|
|
|
$start = date("Y-01-01 ") ."00:00:00"; |
|
|
|
$end = date("Y-12-31 ") ."23:59:59"; |
|
|
|
$where = ' "date" = ' . "'year'" . ' and "group_id" = ' . "'{$group_id}'" |
|
|
|
. ' and "create_time" >= ' . "'{$start}'" . ' and "create_time" <= ' . "'{$end}'"; |
|
|
|
$libData = $dm->find('bt_library_data',$where,'incount'); |
|
|
|
return $libData['incount'] ?: 0; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 文化-博物-图书-数据接口 总计服务人数 |
|
|
|
* @return array |
|
|
|
@ -535,7 +555,7 @@ class PassFlow |
|
|
|
$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; |
|
|
|
$ts_year_incount = self::getWhYearData($dm,'baz001'); |
|
|
|
|
|
|
|
# 劳务博物馆数据 |
|
|
|
$dateArr = ['day' => 'daily', 'month' => 'monthly', 'year' => 'yearly']; |
|
|
|
@ -556,7 +576,7 @@ class PassFlow |
|
|
|
$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; |
|
|
|
$wh_year_incount = self::getWhYearData($dm,'BAF055'); |
|
|
|
|
|
|
|
# 总年、月、日总数 |
|
|
|
$sum_today_incount = $ts_today_incount + $bw_today_incount + $wh_today_incount; |
|
|
|
|