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
68709346
Commit
68709346
authored
Jun 10, 2019
by
Александр Чаплыгин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил поле CTR в сводный отчет для магазина
parent
ec1e813d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
15 deletions
+48
-15
feeds.global.php
src/config/autoload/feeds.global.php
+1
-0
script-feeds-stat-table.js
src/public/js/script-feeds-stat-table.js
+22
-15
Cabinet.php
src/src/App/Action/User/Cabinet.php
+25
-0
No files found.
src/config/autoload/feeds.global.php
View file @
68709346
...
...
@@ -28,6 +28,7 @@ return [
'cats'
=>
[
'Views'
=>
'Показы'
,
'Clicks'
=>
'Клики'
,
'ctr'
=>
'CTR'
,
'Orders'
=>
'Заказы'
,
'OrderSum'
=>
'Заказы на сумму'
,
'AdMoney'
=>
'Комиссия AddCPM'
...
...
src/public/js/script-feeds-stat-table.js
View file @
68709346
...
...
@@ -68,19 +68,14 @@ $(document).ready(function(){
isNonFormatValue
=
notFormatFields
.
indexOf
(
currentActiveLine
)
>
-
1
,
format
=
d3
.
format
(
',.0f'
);
if
(
currentActiveLine
==
'AdMoney'
)
{
format
=
d3
.
format
(
',.2f'
);
}
if
(
isNonFormatValue
)
{
return
value
;
}
if
(
isCurrencyValue
)
{
return
format
(
value
)
+
' грн.'
;
}
else
{
return
format
(
value
);
}
if
(
currentActiveLine
==
'AdMoney'
)
format
=
d3
.
format
(
',.2f'
);
if
(
currentActiveLine
==
'ctr'
)
format
=
d3
.
format
(
',.2f'
);
if
(
isCurrencyValue
)
return
format
(
value
)
+
' грн.'
;
if
(
currentActiveLine
==
'ctr'
)
return
format
(
value
)
+
' %'
;
if
(
isNonFormatValue
)
return
value
;
return
format
(
value
);
}
function
getDateValue
(
dataDate
)
...
...
@@ -242,9 +237,21 @@ $(document).ready(function(){
if
(
!
isNotSumValue
)
{
var
totalValue
=
0
;
for
(
var
i
=
dataPeriod
.
length
-
1
;
i
>=
0
;
i
--
)
{
totalValue
+=
dataTable
[
item
][
i
];
if
(
currentActiveLine
==
'ctr'
)
{
var
totalViews
=
0
;
var
totalClicks
=
0
;
for
(
var
i
=
dataPeriod
.
length
-
1
;
i
>=
0
;
i
--
)
{
totalViews
+=
dataTable
[
'Views'
][
i
];
totalClicks
+=
dataTable
[
'Clicks'
][
i
];
}
totalValue
=
(
totalViews
!=
0
)
?
(
totalClicks
/
totalViews
*
100
).
toFixed
(
2
)
:
0
;
}
else
{
for
(
var
i
=
dataPeriod
.
length
-
1
;
i
>=
0
;
i
--
)
{
totalValue
+=
dataTable
[
item
][
i
];
}
}
}
else
{
totalValue
=
''
;
}
...
...
src/src/App/Action/User/Cabinet.php
View file @
68709346
...
...
@@ -146,6 +146,11 @@ class Cabinet extends Common
break
;
}
// Добавляем спец. категории для сводного отчета по магазину:
if
(
$report_type
==
'common'
)
{
$periodStats
=
$this
->
addStatsSpecialCats
(
$periodStats
);
}
// Добавляем данные о статусах заказов:
if
(
$report_type
==
'transactions'
)
{
/** @var \App\Model\Feeds $ordersStatusModel */
...
...
@@ -504,6 +509,11 @@ class Cabinet extends Common
return
new
JsonResponse
(
null
);
}
// Добавляем спец. категории для сводного отчета по магазину:
if
(
$report_type
==
'common'
)
{
$periodStats
=
$this
->
addStatsSpecialCats
(
$periodStats
);
}
// Добавляем данные о статусах заказов:
if
(
$report_type
==
'transactions'
)
{
/** @var \App\Model\Feeds $ordersStatusModel */
...
...
@@ -588,4 +598,18 @@ class Cabinet extends Common
]);
return
$response
;
}
// Добавляем категории для сводного отчета по магазину:
private
function
addStatsSpecialCats
(
$periodStats
)
{
$periodStats
[
'ctr'
]
=
[];
foreach
(
$periodStats
[
'period'
]
as
$ind
=>
$period
)
{
$views_value
=
$periodStats
[
'Views'
][
$ind
];
$clicks_value
=
$periodStats
[
'Clicks'
][
$ind
];
$periodStats
[
'ctr'
][]
=
(
$views_value
!=
0
)
?
round
((
$clicks_value
/
$views_value
)
*
100
,
2
)
:
0
;
}
return
$periodStats
;
}
}
\ No newline at end of file
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