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
f9664726
Commit
f9664726
authored
Jan 23, 2019
by
Александр Чаплыгин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Обработка иключения отсутствия фидов у пользователя
parent
766c66d5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
102 deletions
+82
-102
acl.global.php
src/config/autoload/acl.global.php
+0
-4
Cabinet.php
src/src/App/Action/User/Cabinet.php
+66
-87
cabinet-feed.phtml
src/templates/app/user/cabinet-feed.phtml
+16
-11
No files found.
src/config/autoload/acl.global.php
View file @
f9664726
...
...
@@ -81,10 +81,6 @@ return [
->
allow
(
Roles
::
ROLE_SUPPORT
,
'logout'
)
->
allow
(
Roles
::
ROLE_SUPPORT
,
'adm.profile'
)
// Manager Feed
->
allow
(
Roles
::
ROLE_MANAGER_FEED
,
'adm.feeds'
)
;
...
...
src/src/App/Action/User/Cabinet.php
View file @
f9664726
...
...
@@ -88,89 +88,76 @@ class Cabinet extends Common
/** @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
;
if
(
$feeds
)
{
// Фиды пользователя:
$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'
);
// Текущий месяц:
$current_period
=
'current_month'
;
$dates
=
[
date
(
'Y-m-01'
),
date
(
'Y-m-d'
)];
switch
(
$report_type
)
{
case
'common'
:
$periodStats
=
$stats
->
getFeedStatData
(
$report_type
,
$feed_id_list
,
$dates
);
$cats
=
[
'Views'
=>
'Показы'
,
'Clicks'
=>
'Клики'
,
'Orders'
=>
'Заказы'
,
'OrderSum'
=>
'Заказы на сумму'
,
'AdMoney'
=>
'Комиссия AddCPM'
];
/*
$cats = [
'shows' => 'Показы',
'clicks' => 'Клики',
'transactions' => 'Транзакции',
'salemoney' => 'salemoney',
'admoney' => 'admoney'
];
$report_type
=
$request
->
getAttribute
(
'report'
);
// Текущий месяц:
$current_period
=
'current_month'
;
$dates
=
[
date
(
'Y-m-01'
),
date
(
'Y-m-d'
)];
switch
(
$report_type
)
{
case
'common'
:
$periodStats
=
$stats
->
getFeedStatData
(
$report_type
,
$feed_id_list
,
$dates
);
//$campaignStats = $statsDaysModel->getStatsByFeeds($feed_id_list, $dates);
$cats
=
[
'Views'
=>
'Показы'
,
'Clicks'
=>
'Клики'
,
'Orders'
=>
'Заказы'
,
'OrderSum'
=>
'Заказы на сумму'
,
'AdMoney'
=>
'Комиссия AddCPM'
];
break
;
case
'transaction'
:
$periodStats
=
$stats
->
getFeedStatData
(
$report_type
,
$feed_id_list
,
$dates
);
/*
$cats = [
'localmoney' => 'localmoney',
'usdollarmoney' => 'usdollarmoney'
];
*/
$cats
=
[
'Views'
=>
'Показы'
,
'Clicks'
=>
'Клики'
,
'Orders'
=>
'Заказы'
,
'OrderSum'
=>
'Заказы на сумму'
,
'AdMoney'
=>
'Комиссия AddCPM'
];
break
;
default
:
$data
[
'error'
]
=
_t
(
'Извините, тип отчета "'
.
$report_type
.
'" недоступен'
);
break
;
}
$campaignStats = $statsDaysModel->getStatsByFeeds($feed_id_list, $dates);
*/
break
;
case
'transaction'
:
$periodStats
=
$stats
->
getFeedStatData
(
$report_type
,
$feed_id_list
,
$dates
);
/*
$cats = [
'localmoney' => 'localmoney',
'usdollarmoney' => 'usdollarmoney'
];
*/
$cats
=
[
'Views'
=>
'Показы'
,
'Clicks'
=>
'Клики'
,
'Orders'
=>
'Заказы'
,
'OrderSum'
=>
'Заказы на сумму'
,
'AdMoney'
=>
'Комиссия AddCPM'
];
break
;
default
:
$data
[
'error'
]
=
_t
(
'Извините, тип отчета "'
.
$report_type
.
'" недоступен'
);
break
;
$data
[
'feeds'
]
=
$feeds
;
$data
[
'report'
]
=
$report_type
;
$data
[
'current_period'
]
=
$current_period
;
$data
[
'dates'
]
=
$dates
;
$data
[
'periodStats'
]
=
$periodStats
;
//$data['campaignStats'] = $campaignStats;
$data
[
'cats'
]
=
$cats
;
$data
[
'periods_list'
]
=
$this
->
container
->
get
(
'config'
)[
'feed_conf'
][
'periods_list'
];
$data
[
'colors_active_lines'
]
=
$this
->
container
->
get
(
'config'
)[
'feed_conf'
][
'colors_active_lines'
];
}
else
{
$data
[
'error'
]
=
_t
(
'Извините, у пользователя нет фидов'
);
}
/*
$periodStats['type'] = 'interval';
$periodStats['report'] = $report_type;
$campaignStats['type'] = 'interval';
$campaignStats['report'] = $report_type;
$data['campaignStats'] = $campaignStats;
*/
$data
[
'feeds'
]
=
$feeds
;
$data
[
'report'
]
=
$report_type
;
$data
[
'current_period'
]
=
$current_period
;
$data
[
'dates'
]
=
$dates
;
$data
[
'periodStats'
]
=
$periodStats
;
$data
[
'cats'
]
=
$cats
;
$data
[
'periods_list'
]
=
$this
->
container
->
get
(
'config'
)[
'feed_conf'
][
'periods_list'
];
$data
[
'colors_active_lines'
]
=
$this
->
container
->
get
(
'config'
)[
'feed_conf'
][
'colors_active_lines'
];
}
catch
(
\Exception
$e
)
{
$data
[
'error'
]
=
_t
(
'Извините, статистика временно не работает'
);
}
...
...
@@ -214,9 +201,7 @@ class Cabinet extends Common
switch
(
$report_type
)
{
case
'common'
:
$periodStats
=
$stats
->
getFeedStatData
(
$report_type
,
$feed_id_list
,
$dates
);
/*
$campaignStats = $statsDaysModel->getStatsByFeeds($feed_id_list, $dates);
*/
//$campaignStats = $statsDaysModel->getStatsByFeeds($feed_id_list, $dates);
break
;
case
'transaction'
:
$periodStats
=
$stats
->
getFeedStatData
(
$report_type
,
$feed_id_list
,
$dates
);
...
...
@@ -232,12 +217,6 @@ class Cabinet extends Common
}
/*
$periodStats['type'] = 'interval';
$periodStats['report'] = $report_type;
$campaignStats['type'] = 'interval';
$campaignStats['report'] = $report_type;
if ($periodStats || $companyStats) {
$data = array(
'period' => $periodStats,
...
...
src/templates/app/user/cabinet-feed.phtml
View file @
f9664726
...
...
@@ -54,17 +54,22 @@ $sxml = new SimpleXMLElement(substr($gravatar, 0, -1) . '/>');
$src
=
$sxml
[
'src'
];
$error
=
$this
->
error
;
$periodStats
=
$this
->
periodStats
;
//$campaignStats = $this->campaignStats;
$current_period
=
$this
->
current_period
;
$dates
=
$this
->
dates
;
$cats
=
$this
->
cats
;
$report
=
$this
->
report
;
$periods_list
=
$this
->
periods_list
;
$colors_active_lines
=
$this
->
colors_active_lines
;
$data_request_link
=
$this
->
url
(
'user.cabinet'
,
[
'lang'
=>
$this
->
lang
,
'report'
=>
$report
]);
$system_link
=
$this
->
url
(
'adm.system.actions'
);
if
(
!
$error
)
{
$periodStats
=
$this
->
periodStats
;
//$campaignStats = $this->campaignStats;
$current_period
=
$this
->
current_period
;
$dates
=
$this
->
dates
;
$cats
=
$this
->
cats
;
$report
=
$this
->
report
;
$periods_list
=
$this
->
periods_list
;
$colors_active_lines
=
$this
->
colors_active_lines
;
$data_request_link
=
$this
->
url
(
'user.cabinet'
,
[
'lang'
=>
$this
->
lang
,
'report'
=>
$report
]);
$system_link
=
$this
->
url
(
'adm.system.actions'
);
}
?>
...
...
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