|
|
|
@ -23,23 +23,28 @@ class Passcc extends Controller |
|
|
|
public function allGroupTimeNum() { |
|
|
|
|
|
|
|
$granularity = $this->request->param('granularity'); |
|
|
|
$groupsId = $this->request->param('groupsId'); |
|
|
|
|
|
|
|
if (empty($granularity)) return $this->renderError('date参数不能为空'); |
|
|
|
|
|
|
|
$where = []; |
|
|
|
if (!empty($groupsId)) $where['groups_id'] = implode(",",$groupsId); |
|
|
|
$allTimeData = []; |
|
|
|
$groupsData = []; |
|
|
|
if ($granularity == 'daily') { |
|
|
|
$list = Db::table('bt_passenger_flow')->where(['granularity' => 'hourly'])->select()->toArray(); |
|
|
|
$where['granularity'] = 'hourly'; |
|
|
|
$list = Db::table('bt_passenger_flow')->where($where)->select()->toArray(); |
|
|
|
$data = $this->handleGroupData($list); |
|
|
|
$allTimeData = $data['allTimeData']; |
|
|
|
$groupsData = $data['groupsData']; |
|
|
|
} elseif ($granularity == 'monthly') { |
|
|
|
$list = Db::table('bt_passenger_flow')->where(['granularity' => 'daily'])->select()->toArray(); |
|
|
|
$where['granularity'] = 'daily'; |
|
|
|
$list = Db::table('bt_passenger_flow')->where($where)->select()->toArray(); |
|
|
|
$data = $this->handleGroupData($list,'d'); |
|
|
|
$allTimeData = $data['allTimeData']; |
|
|
|
$groupsData = $data['groupsData']; |
|
|
|
} elseif ($granularity == 'yearly') { |
|
|
|
$list = Db::table('bt_passenger_flow')->where(['granularity' => 'monthly'])->select()->toArray(); |
|
|
|
$where['granularity'] = 'monthly'; |
|
|
|
$list = Db::table('bt_passenger_flow')->where($where)->select()->toArray(); |
|
|
|
$data = $this->handleGroupData($list,'m'); |
|
|
|
$allTimeData = $data['allTimeData']; |
|
|
|
$groupsData = $data['groupsData']; |
|
|
|
|