public function fetch_scope_statistics_by_stock_user($begin_time = NULL, $end_time = NULL, $priority = 1, $shipper = NULL, $split_date = TRUE) { if ($split_date) { $scope = split_time_scope($begin_time, $end_time); } else { $scope[] = array('begin_time' => $begin_time, 'end_time' => $end_time); } $scope_statistics = array(); $stock_user = array(); foreach ($scope as $row) { $begin_time = $row['begin_time']; $end_time = $row['end_time']; $statistics = $this->fetch_statistics_by_stock_user($begin_time, $end_time, $priority, $shipper); $stock_user = array_unique(array_merge($stock_user, $statistics['stock_user'])); unset($statistics['stock_user']); $scope_statistics[] = array('begin_time' => $begin_time, 'end_time' => $end_time, 'statistics' => $statistics); } return array($scope_statistics, $stock_user); }
public function fetch_scope_statistics($begin_time = NULL, $end_time = NULL, $priority = 1, $purchaser_id = NULL, $split_date = TRUE) { if ($split_date) { $scope = split_time_scope($begin_time, $end_time); } else { $scope[] = array('begin_time' => $begin_time, 'end_time' => $end_time); } $scope_statistics = array(); $all_purchasers = array(); foreach ($scope as $row) { $begin_time = $row['begin_time']; $end_time = $row['end_time']; $statistics = $this->fetch_statistics($begin_time, $end_time, $priority, $purchaser_id); $all_purchasers = array_merge($all_purchasers, array_keys($statistics)); unset($statistics['purchasers']); $scope_statistics[] = array('begin_time' => $begin_time, 'end_time' => $end_time, 'statistics' => $statistics); } return array($scope_statistics, $all_purchasers); }