|
|
@ -6,6 +6,17 @@ use app\common\dm\Dm; |
|
|
|
|
|
|
|
|
class PassFlow |
|
|
class PassFlow |
|
|
{ |
|
|
{ |
|
|
|
|
|
protected static $groupType = [1,2];# 1 = 体育 2 = 文化 |
|
|
|
|
|
|
|
|
|
|
|
protected static function getGroupIds($dm,$type = 1) |
|
|
|
|
|
{ |
|
|
|
|
|
$groupIdArr = []; |
|
|
|
|
|
$result = $dm->select('bt_passenger_monitor_group',['type' => $type]); |
|
|
|
|
|
foreach ($result as $row) { |
|
|
|
|
|
$groupIdArr[] = $row['groupId']; |
|
|
|
|
|
} |
|
|
|
|
|
return $groupIdArr; |
|
|
|
|
|
} |
|
|
/** |
|
|
/** |
|
|
* 分时时间段接口 <首页-客流趋势> |
|
|
* 分时时间段接口 <首页-客流趋势> |
|
|
* @return array |
|
|
* @return array |
|
|
@ -17,14 +28,16 @@ class PassFlow |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
$granularity = $param['granularity']; |
|
|
$granularity = $param['granularity']; |
|
|
$groupsId = $param['groupsId']; |
|
|
$type = $param['type']; |
|
|
|
|
|
|
|
|
if (empty($granularity)) return ['code' => 0, 'msg' => '缺少参数:granularity']; |
|
|
if (empty($granularity)) return ['code' => 0, 'msg' => '缺少参数:granularity']; |
|
|
$where = ''; |
|
|
$where = ''; |
|
|
if (!empty($groupsId)) { |
|
|
$groupsId = ''; |
|
|
$garr = explode("|", $groupsId); |
|
|
if (!empty($type)) { |
|
|
$where .= ' "groupId" in(' . "'" . implode("','", $garr) . "')"; |
|
|
if (!in_array($type,self::$groupType)) return ['code' => 0, 'msg' => 'type字段参数错误']; |
|
|
|
|
|
$groupsIdArr = self::getGroupIds($dm,$type); |
|
|
|
|
|
$groupsId = implode("|",$groupsIdArr); |
|
|
|
|
|
$where .= ' "groupId" in(' . "'" . implode("','", $groupsIdArr) . "')"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$allTimeData = []; |
|
|
$allTimeData = []; |
|
|
@ -251,8 +264,9 @@ class PassFlow |
|
|
if (empty($dm)) $dm = new Dm(); |
|
|
if (empty($dm)) $dm = new Dm(); |
|
|
$paramWhere = ''; |
|
|
$paramWhere = ''; |
|
|
if (!empty($param)) { |
|
|
if (!empty($param)) { |
|
|
if (!empty($param['groupsId'])) { |
|
|
if (!empty($param['type'])) { |
|
|
$groupsId = explode("|",$param['groupsId']); |
|
|
if (!in_array($param['type'],self::$groupType)) return ['code' => 0, 'msg' => 'type字段参数错误']; |
|
|
|
|
|
$groupsId = self::getGroupIds($dm,$param['type']); |
|
|
$paramWhere .= ' and "groupId" in (' . "'" . implode("','",$groupsId) . "')"; |
|
|
$paramWhere .= ' and "groupId" in (' . "'" . implode("','",$groupsId) . "')"; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -394,9 +408,11 @@ class PassFlow |
|
|
|
|
|
|
|
|
$where = ' "granularity"='."'hourly' "; |
|
|
$where = ' "granularity"='."'hourly' "; |
|
|
$groupsWhere = null; |
|
|
$groupsWhere = null; |
|
|
|
|
|
$groupsId = []; |
|
|
if (!empty($param)) { |
|
|
if (!empty($param)) { |
|
|
if (!empty($param['groupsId'])) { |
|
|
if (!empty($param['type'])) { |
|
|
$groupsId = explode("|",$param['groupsId']); |
|
|
if (!in_array($param['type'],self::$groupType)) return ['code' => 0, 'msg' => 'type字段参数错误']; |
|
|
|
|
|
$groupsId = self::getGroupIds($dm,$param['type']); |
|
|
$groupsWhere = ['groupId' => $groupsId]; |
|
|
$groupsWhere = ['groupId' => $groupsId]; |
|
|
$where .= ' and "groupId" in (' . "'" . implode("','",$groupsId) . "')"; |
|
|
$where .= ' and "groupId" in (' . "'" . implode("','",$groupsId) . "')"; |
|
|
} |
|
|
} |
|
|
@ -448,7 +464,7 @@ class PassFlow |
|
|
'list' => $listData |
|
|
'list' => $listData |
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
if(empty($param['groupsId'])){ |
|
|
if(empty($groupsId)){ |
|
|
$data = self::getLibraryGroupHoursList($dm,false,$data); |
|
|
$data = self::getLibraryGroupHoursList($dm,false,$data); |
|
|
} |
|
|
} |
|
|
return $data; |
|
|
return $data; |
|
|
@ -547,8 +563,9 @@ class PassFlow |
|
|
|
|
|
|
|
|
$where = ' "granularity"='."'hourly' "; |
|
|
$where = ' "granularity"='."'hourly' "; |
|
|
if (!empty($param)) { |
|
|
if (!empty($param)) { |
|
|
if (!empty($param['groupsId'])) { |
|
|
if (!empty($param['type'])) { |
|
|
$groupsId = explode("|",$param['groupsId']); |
|
|
if (!in_array($param['type'], self::$groupType)) return ['code' => 0, 'msg' => 'type字段参数错误']; |
|
|
|
|
|
$groupsId = self::getGroupIds($dm, $param['type']); |
|
|
$where .= ' and "groupId" in (' . "'" . implode("','",$groupsId) . "')"; |
|
|
$where .= ' and "groupId" in (' . "'" . implode("','",$groupsId) . "')"; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|