Отключил обработку post-запросов в контроллере для истоии по клику и заказу

parent 407dc8bb
......@@ -80,12 +80,10 @@ class ViewId extends Common
if($request->getMethod() == 'POST') {
try {
switch ($request->getAttribute('action')) {
case self::ACTION_STAT:
$response = $this->getStatData($request);
break;
default:
}
$data = [
'result' => false,
];
$response = new JsonResponse($data);
} catch(\Exception $e) {
$data = [
'result' => false,
......@@ -183,67 +181,4 @@ class ViewId extends Common
}
}
private function getStatData(ServerRequestInterface $request)
{
/** @var UserService $auth */
$auth = $this->container->get(UserService::class);
$userId = $auth->getIdentity()->getId();
/** @var \App\Model\Statistics $stats */
$stats = $this->container->get(Statistics::class);
// Выводим стр. по фидам, если за пользователем закреплен фид:
/** @var \App\Model\Feeds $feedsModel */
$feedsModel = $this->container->get(Feeds::class);
$feeds = $feedsModel->findAll(['clientid' => $userId])->toArray();
// Фиды пользователя:
$feed_id_list = [];
foreach($feeds as $feed_item) {
$feed_id = $feed_item['id'];
if (!in_array($feed_id, $feed_id_list)) {
$feed_id_list[] = $feed_id;
}
}
$report_type = $request->getAttribute('report');
$data_request = $request->getParsedBody();
$dates = $data_request['period'];
$report_conf = $this->container->get('config')['feed_conf']['reports'][$report_type];
switch ($report_type) {
case 'common':
$periodStats = $stats->getFeedStatData($report_type, $feed_id_list, $dates, $report_conf);
//$campaignStats = $statsDaysModel->getStatsByFeeds($feed_id_list, $dates);
break;
case 'transactions':
$periodStats = $stats->getFeedStatData($report_type, $feed_id_list, $dates, $report_conf);
break;
default:
$periodStats = null;
$campaignStats = null;
break;
}
if (!$periodStats) {
return new JsonResponse(null);
}
/*
if ($periodStats || $companyStats) {
$data = array(
'period' => $periodStats,
'campaign' => $campaignStats,
);
} else {
$data = null;
}
*/
$data = $periodStats;
return new JsonResponse($data);
}
}
\ No newline at end of file
......@@ -287,9 +287,6 @@ class Statistics
'data' => array(
'feed_id' => (int) $feed_id,
'view_id' => $view_id
//'feed_id' => 10004,
//'view_id' => '94ed3f578fa785d3'
)
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment