|
|
|
@ -35,6 +35,12 @@ class PassFlow |
|
|
|
} |
|
|
|
return $groupIdArr; |
|
|
|
} |
|
|
|
|
|
|
|
protected static function getGroupIdArr() { |
|
|
|
$arr = ['110', '210', '310', '510', '610']; |
|
|
|
return "'" . implode("','", $arr) . "'"; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 分时时间段接口 <首页-客流趋势> |
|
|
|
* @return array |
|
|
|
@ -69,6 +75,7 @@ class PassFlow |
|
|
|
$end_time = $date['day']['end_time']; |
|
|
|
$where .= $where ? ' and "granularity" = ' . "'hourly'" : ' "granularity" = ' . "'hourly'"; |
|
|
|
$where .= ' and "statTime" >= ' . "'{$start_time}'" . ' and "statTime" <= ' . "'{$end_time}'"; |
|
|
|
$where .= ' and "groupId" in (' . self::getGroupIdArr() . ')'; |
|
|
|
$list = $dm->select('bt_passenger_flow', $where); |
|
|
|
$data = self::handleGroupData($list,'H:00',$dm,$groupsId); |
|
|
|
$allTimeData = $data['allTimeData']; |
|
|
|
@ -80,6 +87,7 @@ class PassFlow |
|
|
|
$end_time = $date['month']['end_time']; |
|
|
|
$where .= $where ? ' and "granularity" = ' . "'daily'" : ' "granularity" = ' . "'daily'"; |
|
|
|
$where .= ' and "statTime" >= ' . "'{$start_time}'" . ' and "statTime" <= ' . "'{$end_time}'"; |
|
|
|
$where .= ' and "groupId" in (' . self::getGroupIdArr() . ')'; |
|
|
|
$list = $dm->select('bt_passenger_flow', $where); |
|
|
|
$data = self::handleGroupData($list, 'd',$dm,$groupsId); |
|
|
|
$allTimeData = $data['allTimeData']; |
|
|
|
@ -91,6 +99,7 @@ class PassFlow |
|
|
|
$end_time = $date['year']['end_time']; |
|
|
|
$where .= $where ? ' and "granularity" = ' . "'monthly'" : ' "granularity" = ' . "'monthly'"; |
|
|
|
$where .= ' and "statTime" >= ' . "'{$start_time}'" . ' and "statTime" <= ' . "'{$end_time}'"; |
|
|
|
$where .= ' and "groupId" in (' . self::getGroupIdArr() . ')'; |
|
|
|
$list = $dm->select('bt_passenger_flow', $where); |
|
|
|
$data = self::handleGroupData($list, 'm',$dm,$groupsId); |
|
|
|
$allTimeData = $data['allTimeData']; |
|
|
|
@ -294,6 +303,7 @@ class PassFlow |
|
|
|
foreach ($dateArr as $date => $granularity) { |
|
|
|
$where = ' "granularity" = ' . "'{$granularity}'" . ' and "date" = ' . "'{$date}' {$paramWhere}"; |
|
|
|
$where .= ' and "statTime" >= ' . "'{$dateData[$date]['start_time']}'" . ' and "statTime" <= ' . "'{$dateData[$date]['end_time']}'"; |
|
|
|
$where .= ' and "groupId" in (' . self::getGroupIdArr() . ')'; |
|
|
|
$list = $dm->select( |
|
|
|
'bt_passenger_flow_all', |
|
|
|
$where |
|
|
|
@ -313,6 +323,7 @@ class PassFlow |
|
|
|
#累计进馆人数 |
|
|
|
$sumWhere = ' "granularity" = ' . "'yearly'" . ' and "date" = ' . "'year' {$paramWhere}" |
|
|
|
. ' and "statTime" >= ' . "'{$dateData['year']['start_time']}'" . ' and "statTime" <= ' . "'{$dateData['year']['end_time']}'"; |
|
|
|
$sumWhere .= ' and "groupId" in (' . self::getGroupIdArr() . ')'; |
|
|
|
$sumFind = $dm->find('bt_passenger_flow_all', $sumWhere,'SUM("flowInNum") as NUM'); |
|
|
|
$returnData['sumYear']['noRepeatInNum'] = isset($sumFind['NUM']) ? $sumFind['NUM'] : 0; |
|
|
|
|
|
|
|
@ -358,8 +369,8 @@ class PassFlow |
|
|
|
public static function realTimeData($dm = null) |
|
|
|
{ |
|
|
|
if (empty($dm)) $dm = new Dm(); |
|
|
|
|
|
|
|
$list = $dm->select('bt_passenger_flow_real'); |
|
|
|
$where = ' "groupId" in (' . self::getGroupIdArr() . ')'; |
|
|
|
$list = $dm->select('bt_passenger_flow_real', $where); |
|
|
|
$data = []; |
|
|
|
|
|
|
|
// $configRes = $dm->find("bt_config",' "key" = ' . "'threshold'"); |
|
|
|
@ -482,6 +493,7 @@ class PassFlow |
|
|
|
$start_time = $date['day']['start_time']; |
|
|
|
$end_time = $date['day']['end_time']; |
|
|
|
$where .= ' and "statTime" >= ' . "'{$start_time}'" . ' and "statTime" <= ' . "'{$end_time}'"; |
|
|
|
$where .= ' and "groupId" in (' . self::getGroupIdArr() . ')'; |
|
|
|
$list = $dm->select('bt_passenger_flow',$where); |
|
|
|
$allTimeData = []; |
|
|
|
for ($i = 0; $i <= 23; $i++) { |
|
|
|
@ -661,6 +673,7 @@ class PassFlow |
|
|
|
$end_time = date("Y-m-d\TH") . ':59:59.000+08:00'; |
|
|
|
|
|
|
|
$where .= ' and "statTime" >= ' . "'{$start_time}'" . ' and "statTime" <= ' . "'{$end_time}'"; |
|
|
|
$where .= ' and "groupId" in (' . self::getGroupIdArr() . ')'; |
|
|
|
$list = $dm->select('bt_passenger_flow',$where); |
|
|
|
$allTimeData = []; |
|
|
|
$returnData = []; |
|
|
|
|