Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
addcpm-json
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Александр Чаплыгин
addcpm-json
Commits
29af8eab
Commit
29af8eab
authored
Jan 24, 2019
by
Александр Чаплыгин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Проброс конфигов отчетов в запрос статистики
parent
01221e85
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
Cabinet.php
src/src/App/Action/User/Cabinet.php
+8
-4
Statistics.php
src/src/App/Model/Statistics.php
+8
-7
No files found.
src/src/App/Action/User/Cabinet.php
View file @
29af8eab
...
@@ -106,13 +106,15 @@ class Cabinet extends Common
...
@@ -106,13 +106,15 @@ class Cabinet extends Common
$current_period
=
'current_month'
;
$current_period
=
'current_month'
;
$dates
=
[
date
(
'Y-m-01'
),
date
(
'Y-m-d'
)];
$dates
=
[
date
(
'Y-m-01'
),
date
(
'Y-m-d'
)];
$report_conf
=
$this
->
container
->
get
(
'config'
)[
'feed_conf'
][
'reports'
][
$report_type
];
switch
(
$report_type
)
{
switch
(
$report_type
)
{
case
'common'
:
case
'common'
:
$periodStats
=
$stats
->
getFeedStatData
(
$report_type
,
$feed_id_list
,
$dates
);
$periodStats
=
$stats
->
getFeedStatData
(
$report_type
,
$feed_id_list
,
$dates
,
$report_conf
);
//$campaignStats = $statsDaysModel->getStatsByFeeds($feed_id_list, $dates);
//$campaignStats = $statsDaysModel->getStatsByFeeds($feed_id_list, $dates);
break
;
break
;
case
'transaction'
:
case
'transaction'
:
$periodStats
=
$stats
->
getFeedStatData
(
$report_type
,
$feed_id_list
,
$dates
);
$periodStats
=
$stats
->
getFeedStatData
(
$report_type
,
$feed_id_list
,
$dates
,
$report_conf
);
break
;
break
;
default
:
default
:
$data
[
'error'
]
=
_t
(
'Извините, тип отчета "'
.
$report_type
.
'" недоступен'
);
$data
[
'error'
]
=
_t
(
'Извините, тип отчета "'
.
$report_type
.
'" недоступен'
);
...
@@ -173,13 +175,15 @@ class Cabinet extends Common
...
@@ -173,13 +175,15 @@ class Cabinet extends Common
$data_request
=
$request
->
getParsedBody
();
$data_request
=
$request
->
getParsedBody
();
$dates
=
$data_request
[
'period'
];
$dates
=
$data_request
[
'period'
];
$report_conf
=
$this
->
container
->
get
(
'config'
)[
'feed_conf'
][
'reports'
][
$report_type
];
switch
(
$report_type
)
{
switch
(
$report_type
)
{
case
'common'
:
case
'common'
:
$periodStats
=
$stats
->
getFeedStatData
(
$report_type
,
$feed_id_list
,
$dates
);
$periodStats
=
$stats
->
getFeedStatData
(
$report_type
,
$feed_id_list
,
$dates
,
$report_conf
);
//$campaignStats = $statsDaysModel->getStatsByFeeds($feed_id_list, $dates);
//$campaignStats = $statsDaysModel->getStatsByFeeds($feed_id_list, $dates);
break
;
break
;
case
'transaction'
:
case
'transaction'
:
$periodStats
=
$stats
->
getFeedStatData
(
$report_type
,
$feed_id_list
,
$dates
);
$periodStats
=
$stats
->
getFeedStatData
(
$report_type
,
$feed_id_list
,
$dates
,
$report_conf
);
break
;
break
;
default
:
default
:
$periodStats
=
null
;
$periodStats
=
null
;
...
...
src/src/App/Model/Statistics.php
View file @
29af8eab
...
@@ -15,8 +15,9 @@ class Statistics
...
@@ -15,8 +15,9 @@ class Statistics
// Данные по отчетам фидов
// Данные по отчетам фидов
public
function
getFeedStatData
(
$report_type
,
$feed_id_list
,
$dates
)
public
function
getFeedStatData
(
$report_type
,
$feed_id_list
,
$dates
,
$report_conf
)
{
{
$timeDiff
=
(
strtotime
(
$dates
[
1
])
-
strtotime
(
$dates
[
0
]))
/
(
24
*
60
*
60
);
$timeDiff
=
(
strtotime
(
$dates
[
1
])
-
strtotime
(
$dates
[
0
]))
/
(
24
*
60
*
60
);
// Определяем разрешение выборки (группировку) по времени:
// Определяем разрешение выборки (группировку) по времени:
if
(
$timeDiff
==
0
)
// Одни сутки
if
(
$timeDiff
==
0
)
// Одни сутки
...
@@ -28,6 +29,12 @@ class Statistics
...
@@ -28,6 +29,12 @@ class Statistics
$dates_group
=
"Day"
;
$dates_group
=
"Day"
;
}
}
$dates
=
array
(
'group'
=>
$dates_group
,
'start'
=>
$dates
[
0
],
'end'
=>
$dates
[
1
],
);
// Параметры запроса по типу отчета:
// Параметры запроса по типу отчета:
switch
(
$report_type
)
{
switch
(
$report_type
)
{
case
'common'
:
case
'common'
:
...
@@ -39,12 +46,6 @@ class Statistics
...
@@ -39,12 +46,6 @@ class Statistics
$fields
=
[
'Views'
,
'Clicks'
,
'Orders'
,
'OrderSum'
];
$fields
=
[
'Views'
,
'Clicks'
,
'Orders'
,
'OrderSum'
];
break
;
break
;
}
}
$dates
=
array
(
'group'
=>
$dates_group
,
'start'
=>
$dates
[
0
],
'end'
=>
$dates
[
1
],
);
// Данные для запроса:
// Данные для запроса:
$dataRequest
=
array
(
$dataRequest
=
array
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment