public function listSiteStatsAction() { $params = json_decode(file_get_contents('php://input')); //$list = SiteStats::find("site_id = $params->site_id"); $list = SiteStats::query()->where("site_id = {$params->site_id}"); if ($params->from_time > 0) { $list->andWhere("time >= {$params->from_time}"); } if ($params->to_time > 0) { $list->andWhere("time <= {$params->to_time}"); } $list = $list->execute(); $this->view->disable(); echo json_encode(array("data" => $list->toArray())); }