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
21433b29
Commit
21433b29
authored
May 22, 2019
by
Александр Чаплыгин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Логика показа информации по истории транзакции заказа
parent
f40b0399
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
116 additions
and
11 deletions
+116
-11
acl.global.php
src/config/autoload/acl.global.php
+1
-0
routes.global.php
src/config/autoload/routes.global.php
+17
-0
script-feeds-stat-table.js
src/public/js/script-feeds-stat-table.js
+14
-1
ViewId.php
src/src/App/Action/User/ViewId.php
+51
-8
Statistics.php
src/src/App/Model/Statistics.php
+32
-1
cabinet-feed-click-history.phtml
src/templates/app/user/cabinet-feed-click-history.phtml
+1
-1
No files found.
src/config/autoload/acl.global.php
View file @
21433b29
...
@@ -36,6 +36,7 @@ return [
...
@@ -36,6 +36,7 @@ return [
->
allow
(
Roles
::
ROLE_USER
,
'user.cabinet.cats'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'user.cabinet.cats'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'user.cabinet.profile'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'user.cabinet.profile'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'user.cabinet.viewid'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'user.cabinet.viewid'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'user.cabinet.orderid'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'install.counter'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'install.counter'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'download.counter'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_USER
,
'download.counter'
,
null
,
new
\App\Acl\Assertion\UserActive
())
->
allow
(
Roles
::
ROLE_GUEST
,
'email.counter'
)
->
allow
(
Roles
::
ROLE_GUEST
,
'email.counter'
)
...
...
src/config/autoload/routes.global.php
View file @
21433b29
...
@@ -345,6 +345,23 @@ return [
...
@@ -345,6 +345,23 @@ return [
]
]
],
],
],
],
[
'name'
=>
'user.cabinet.orderid'
,
'path'
=>
'/[:lang/]cabinet/orderid/:feedid/:id'
,
'middleware'
=>
App\Action\User\ViewId
::
class
,
'allowed_methods'
=>
[
'GET'
,
'POST'
],
'options'
=>
[
'constraints'
=>
[
'lang'
=>
'[a-z]{2,3}'
,
'feedid'
=>
'\w+'
,
'id'
=>
'\w+'
,
],
'defaults'
=>
[
'lang'
=>
\App\Model\Locales
::
DEFAULT_LANG
,
'action'
=>
App\Action\User\ViewId
::
ACTION_STAT_ORDER
,
]
],
],
[
[
'name'
=>
'user.cabinet.profile'
,
'name'
=>
'user.cabinet.profile'
,
'path'
=>
'/[:lang/]cabinet/profile/'
,
'path'
=>
'/[:lang/]cabinet/profile/'
,
...
...
src/public/js/script-feeds-stat-table.js
View file @
21433b29
...
@@ -33,6 +33,11 @@ $(document).ready(function(){
...
@@ -33,6 +33,11 @@ $(document).ready(function(){
' <span><%=data.date %></span><br />
\
n'
+
' <span><%=data.date %></span><br />
\
n'
+
''
);
''
);
// Шаблон ячейки OrderID
var
templateOrderIDContent
=
_
.
template
(
'
\
n'
+
' <a class="orderid-link" href="orderid/<%=data.feedId %>/<%=data.orderId %>" target="_blank"><%=data.orderId %></a>
\
n'
+
''
);
// Шаблон ячейки ViewID
// Шаблон ячейки ViewID
var
templateViewIDContent
=
_
.
template
(
'
\
n'
+
var
templateViewIDContent
=
_
.
template
(
'
\
n'
+
' <a class="viewid-link" href="viewid/<%=data.feedId %>/<%=data.viewId %>" target="_blank"><%=data.viewId %></a>
\
n'
+
' <a class="viewid-link" href="viewid/<%=data.feedId %>/<%=data.viewId %>" target="_blank"><%=data.viewId %></a>
\
n'
+
...
@@ -140,7 +145,15 @@ $(document).ready(function(){
...
@@ -140,7 +145,15 @@ $(document).ready(function(){
// Отрисовка таблицы:
// Отрисовка таблицы:
dataTableForSort
.
forEach
(
function
(
item
){
dataTableForSort
.
forEach
(
function
(
item
){
$row
=
$
(
'<tr>'
);
$row
=
$
(
'<tr>'
);
$row
.
append
(
$
(
'<td>'
).
html
(
item
[
'period'
]));
if
(
dataLineChartStat
.
report
==
'transactions'
)
{
$row
.
append
(
$
(
'<td>'
).
append
(
templateOrderIDContent
({
data
:
{
feedId
:
item
[
'ViewID'
][
0
],
orderId
:
item
[
'period'
]}
})));
}
else
{
$row
.
append
(
$
(
'<td>'
).
html
(
item
[
'period'
]));
}
activeLines
.
forEach
(
function
(
line
){
activeLines
.
forEach
(
function
(
line
){
if
(
line
==
'Basket'
)
{
if
(
line
==
'Basket'
)
{
var
dataBasket
=
item
[
line
];
var
dataBasket
=
item
[
line
];
...
...
src/src/App/Action/User/ViewId.php
View file @
21433b29
...
@@ -46,16 +46,24 @@ use Zend\Diactoros\Response\RedirectResponse;
...
@@ -46,16 +46,24 @@ use Zend\Diactoros\Response\RedirectResponse;
class
ViewId
extends
Common
class
ViewId
extends
Common
{
{
const
ACTION_STAT
=
'stat'
;
const
ACTION_STAT
=
'stat'
;
const
ACTION_STAT_ORDER
=
'stat_order'
;
const
STAT_CATS
=
array
(
const
STAT_CATS
=
array
(
'StartTime'
=>
'StartTime'
,
'StartTime'
=>
'StartTime'
,
'EndTime'
=>
'EndTime'
,
'EndTime'
=>
'EndTime'
,
'IP'
=>
'IP'
,
'IP'
=>
'IP'
,
'Basket'
=>
'Состав корзины'
,
'Basket'
=>
'Состав корзины'
,
'Pages'
=>
'Pages'
,
'Pages'
=>
'Pages'
,
//'TransactionID' => 'TransactionID',
'ForeignID'
=>
'ForeignID'
,
'ForeignID'
=>
'ForeignID'
,
'OrderSum'
=>
'OrderSum'
,
'OrderSum'
=>
'OrderSum'
,
);
);
const
STAT_CATS_ORDER
=
array
(
'Timestamp'
=>
'DateTime'
,
'IP'
=>
'IP'
,
'VisitorID'
=>
'UserID'
,
'ViewID'
=>
'ViewID'
,
'OrderIP'
=>
'OrderIP'
,
'URL'
=>
'URL'
,
);
/**
/**
* @param ServerRequestInterface $request
* @param ServerRequestInterface $request
...
@@ -86,16 +94,51 @@ class ViewId extends Common
...
@@ -86,16 +94,51 @@ class ViewId extends Common
$response
=
new
JsonResponse
(
$data
);
$response
=
new
JsonResponse
(
$data
);
}
}
return
$response
;
return
$response
;
}
elseif
(
$request
->
getAttribute
(
'action'
)
==
self
::
ACTION_STAT_ORDER
)
{
}
else
{
try
{
$feed_id
=
$request
->
getAttribute
(
'feedid'
);
$order_id
=
$request
->
getAttribute
(
'id'
);
/** @var UserService $auth */
$auth
=
$this
->
container
->
get
(
UserService
::
class
);
$userId
=
$auth
->
getIdentity
()
->
getId
();
/** @var \App\Model\Feeds $feedsModel */
$feedsModel
=
$this
->
container
->
get
(
Feeds
::
class
);
$feed_item
=
$feedsModel
->
findById
(
$feed_id
);
if
(
$feed_item
)
{
if
(
$feed_item
->
getClientid
()
==
$userId
){
// Статистика-история по клику:
$orderIdStats
=
$stats
->
getOrderIdStatData
(
$feed_id
,
$order_id
);
$data
[
'viewIdStats'
]
=
$orderIdStats
;
$data
[
'cats'
]
=
self
::
STAT_CATS_ORDER
;
}
else
{
$data
[
'error'
]
=
_t
(
'Извините, данный фид закреплен за другим пользователем'
);
}
}
else
{
$data
[
'error'
]
=
_t
(
'Извините, фид не найден'
);
}
}
catch
(
\Exception
$e
)
{
$data
[
'error'
]
=
_t
(
'Извините, история визитов по заказу временно не работает'
);
}
/*
$data
=
array_merge
(
$data
,
[
$feed_id = $request->getAttribute('feedid');
'lang'
=>
$request
->
getAttribute
(
'layoutInfo'
)
->
getLang
(),
$view_id = $request->getAttribute('id');
'layoutInfo'
=>
$request
->
getAttribute
(
'layoutInfo'
),
]);
return
new
HtmlResponse
(
$this
->
template
->
render
(
'app::user/cabinet-feed-click-history'
,
$data
));
$viewIdStats = $stats->getViewIdStatData($feed_id, $view_id);
}
else
{
return new JsonResponse($viewIdStats);
*/
try
{
try
{
...
...
src/src/App/Model/Statistics.php
View file @
21433b29
...
@@ -312,7 +312,38 @@ class Statistics
...
@@ -312,7 +312,38 @@ class Statistics
return
$stats
;
return
$stats
;
}
}
// Данные по статистике по заказу фида
public
function
getOrderIdStatData
(
$feed_id
,
$order_id
)
{
$dataRequest
=
array
(
'method'
=>
'feed_order_history'
,
'data'
=>
array
(
'feed_id'
=>
(
int
)
$feed_id
,
'order_id'
=>
$order_id
)
);
//return $dataRequest;
//$stats = $this->apiRequest($dataRequest);
//return $stats;
try
{
$stats
=
$this
->
apiRequest
(
$dataRequest
);
}
catch
(
\Exception
$e
)
{
$stats
[
'status'
]
=
'Error'
;
}
// В запросе ошибка или отсутствуют данные для статистики:
if
(
$stats
[
'status'
]
==
'Error'
)
{
return
$stats
;
}
if
(
$stats
[
'data'
]
==
[])
{
return
null
;
}
$stats
=
$stats
[
'data'
];
return
$stats
;
}
// Запрос к API:
// Запрос к API:
private
function
apiRequest
(
$data
)
private
function
apiRequest
(
$data
)
...
...
src/templates/app/user/cabinet-feed-click-history.phtml
View file @
21433b29
...
@@ -99,7 +99,7 @@ if (!$error) {
...
@@ -99,7 +99,7 @@ if (!$error) {
<?php
foreach
(
$cats
as
$name
=>
$title
)
:
?>
<?php
foreach
(
$cats
as
$name
=>
$title
)
:
?>
<td
class=
"
<?=
$name
?>
"
data-id=
"
<?=
$name
?>
"
>
<td
class=
"
<?=
$name
?>
"
data-id=
"
<?=
$name
?>
"
>
<?php
if
(
$name
==
'StartTime'
||
$name
==
'EndTime'
)
:
?>
<?php
if
(
$name
==
'StartTime'
||
$name
==
'EndTime'
||
$name
==
'Timestamp'
)
:
?>
<?php
<?php
$date_time
=
explode
(
" "
,
$view_id
[
$name
]);
$date_time
=
explode
(
" "
,
$view_id
[
$name
]);
?>
?>
...
...
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