Добвил контроллер для статистики Statisctics

parent a1df3c52
...@@ -263,9 +263,9 @@ return [ ...@@ -263,9 +263,9 @@ return [
}, },
\App\Model\Statistics::class => function(ContainerInterface $container) { \App\Model\Statistics::class => function(ContainerInterface $container) {
return new \App\Model\Statistics( return new \App\Model\Statistics(
$container->get(\App\Model\Sites::class), //$container->get(\App\Model\Sites::class),
$container->get(\App\Model\Zones::class), //$container->get(\App\Model\Zones::class),
$container->get('config')['country_codes'] //$container->get('config')['country_codes']
); );
}, },
], ],
......
This diff is collapsed.
...@@ -58,6 +58,9 @@ class Cabinet extends Common ...@@ -58,6 +58,9 @@ class Cabinet extends Common
function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next = null) function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next = null)
{ {
/** @var \App\Model\Statistics $stats */
$stats = $this->container->get(Statistics::class);
if($request->getMethod() == 'POST') { if($request->getMethod() == 'POST') {
try { try {
...@@ -109,7 +112,8 @@ class Cabinet extends Common ...@@ -109,7 +112,8 @@ class Cabinet extends Common
$statsDaysModel = $this->container->get(StatsDays::class); $statsDaysModel = $this->container->get(StatsDays::class);
//$stats = $statsDaysModel->findAll(['FeedID' => $feed_id_list])->toArray(); //$stats = $statsDaysModel->findAll(['FeedID' => $feed_id_list])->toArray();
$periodStats = $statsDaysModel->getStatsByDate($feed_id_list, $dates); $periodStats = $statsDaysModel->getStatsByDate($feed_id_list, $dates);
$campaignStats = $statsDaysModel->getStatsByFeeds($feed_id_list, $dates); $stat = $stats->getStatData($metric, $type);
//$campaignStats = $statsDaysModel->getStatsByFeeds($feed_id_list, $dates);
$cats = [ $cats = [
'shows' => 'Показы', 'shows' => 'Показы',
...@@ -119,6 +123,7 @@ class Cabinet extends Common ...@@ -119,6 +123,7 @@ class Cabinet extends Common
'admoney' => 'admoney' 'admoney' => 'admoney'
]; ];
/*
if ($campaignStats || count($campaignStats['period'])>0) { if ($campaignStats || count($campaignStats['period'])>0) {
$feeds_names = []; $feeds_names = [];
foreach($campaignStats['period'] as $feed_id) { foreach($campaignStats['period'] as $feed_id) {
...@@ -127,6 +132,7 @@ class Cabinet extends Common ...@@ -127,6 +132,7 @@ class Cabinet extends Common
} }
$campaignStats['period'] = $feeds_names; $campaignStats['period'] = $feeds_names;
} }
*/
break; break;
case 'transaction': case 'transaction':
...@@ -165,8 +171,9 @@ class Cabinet extends Common ...@@ -165,8 +171,9 @@ class Cabinet extends Common
$data['report'] = $report_type; $data['report'] = $report_type;
$data['current_period'] = $current_period; $data['current_period'] = $current_period;
$data['dates'] = $dates; $data['dates'] = $dates;
$data['stat'] = $stat;
$data['periodStats'] = $periodStats; $data['periodStats'] = $periodStats;
$data['campaignStats'] = $campaignStats; //$data['campaignStats'] = $campaignStats;
$data['cats'] = $cats; $data['cats'] = $cats;
$data['periods_list'] = $this->container->get('config')['feed_conf']['periods_list']; $data['periods_list'] = $this->container->get('config')['feed_conf']['periods_list'];
$data['colors_active_lines'] = $this->container->get('config')['feed_conf']['colors_active_lines']; $data['colors_active_lines'] = $this->container->get('config')['feed_conf']['colors_active_lines'];
......
This diff is collapsed.
...@@ -152,6 +152,8 @@ $system_link = $this->url('adm.system.actions'); ...@@ -152,6 +152,8 @@ $system_link = $this->url('adm.system.actions');
<div id="chart-graph-stat" style="height: 370px;" data-colors=<?= ($colors_active_lines ? json_encode($colors_active_lines) : '')?>></div> <div id="chart-graph-stat" style="height: 370px;" data-colors=<?= ($colors_active_lines ? json_encode($colors_active_lines) : '')?>></div>
<?php endif ?> <?php endif ?>
<?php print_r($stat); ?>
<?php /* Таблица */ ?> <?php /* Таблица */ ?>
<div id="table-stat" class="b-table_wrapp"> <div id="table-stat" class="b-table_wrapp">
<div class="b-content__loading"></div> <div class="b-content__loading"></div>
...@@ -160,7 +162,7 @@ $system_link = $this->url('adm.system.actions'); ...@@ -160,7 +162,7 @@ $system_link = $this->url('adm.system.actions');
<tr> <tr>
<th> <th>
<?php if($report == 'common'): ?> <?php if($report == 'common'): ?>
<b class="main-cat date selected"><?= _t('Дата')?></b> / <b class="main-cat campaign"><?= _t('Кампания')?></b> <b class="main-cat date selected"><?= _t('Дата')?></b><?php /* ?> / <b class="main-cat campaign"><?= _t('Кампания')?></b><?php */ ?>
<?php else: ?> <?php else: ?>
<b class="main-cat date selected"><?= _t('Транзакция')?></b> <b class="main-cat date selected"><?= _t('Транзакция')?></b>
<?php endif; ?> <?php endif; ?>
......
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