Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
workbiu-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gxx
workbiu-admin
Commits
1a33d389
Commit
1a33d389
authored
Dec 12, 2017
by
gxx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改统计部分无数据显示问题
parent
f15b0316
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
65 deletions
+86
-65
StatisticsController.php
app/Http/Controllers/StatisticsController.php
+11
-10
StatisticsService.php
app/Services/StatisticsService.php
+31
-27
index.blade.php
resources/views/admin/index.blade.php
+43
-27
web.php
routes/web.php
+1
-1
No files found.
app/Http/Controllers/StatisticsController.php
View file @
1a33d389
...
...
@@ -101,16 +101,16 @@ class StatisticsController extends Controller
}
// 页面停留时间
public
function
RetentionTime
()
{
$retentionTime
=
$this
->
mStatistics
->
PageRetentionTime
();
$data
=
[];
foreach
(
$retentionTime
as
$key
=>
$v
){
$data
[
0
][]
=
$key
;
$data
[
1
][]
=
[
'value'
=>
$v
,
'name'
=>
$key
]
;
}
return
$data
;
}
//
public function RetentionTime()
//
{
//
$retentionTime = $this->mStatistics->PageRetentionTime();
//
$data=[];
//
foreach ($retentionTime as $key=>$v){
//
$data[0][] =$key;
//
$data[1][] =['value'=>$v,'name'=>$key] ;
//
}
//
return $data;
//
}
// 新用户
...
...
@@ -143,6 +143,7 @@ class StatisticsController extends Controller
$outFlowUser
=
$this
->
mStatistics
->
OutflowUser
();
$activeUser
=
$this
->
mStatistics
->
ActiveUser
();
$userIncrease
=
$this
->
mStatistics
->
UserIncrease
();
$data
[
0
]
=
[
'回访用户'
,
'流失用户'
,
'月活跃用户'
];
$data
[
1
]
=
array
([
'value'
=>
$returnVisitUser
[
'回访用户'
],
'name'
=>
'回访用户'
],[
'value'
=>
$outFlowUser
[
'流失用户'
],
'name'
=>
'流失用户'
],[
'value'
=>
$activeUser
[
'上一个月活跃用户'
],
'name'
=>
'月活跃用户'
]);
return
$data
;
...
...
app/Services/StatisticsService.php
View file @
1a33d389
...
...
@@ -51,24 +51,26 @@ class StatisticsService implements StatisticsServiceContract
})
->
get
();
$users
=
UserInfo
::
all
()
->
count
();
$day
=
0
;
$week
=
0
;
$month
=
0
;
if
(
!
$dayUsers
->
isEmpty
()){
$day
=
count
(
$dayUsers
);
}
if
(
!
$weekUsers
->
isEmpty
()){
$week
=
count
(
$weekUsers
);
}
if
(
!
$monthUsers
->
isEmpty
()){
$month
=
count
(
$monthUsers
);
}
$dayUser
=
ceil
(
$day
/
$users
*
100
);
$weekUser
=
ceil
(
$week
/
$users
*
100
)
;
$monthUser
=
ceil
(
$month
/
$users
*
100
)
;
$date
=
[];
if
(
$users
!=
0
){
$day
=
0
;
$week
=
0
;
$month
=
0
;
if
(
!
$dayUsers
->
isEmpty
()){
$day
=
count
(
$dayUsers
);
}
if
(
!
$weekUsers
->
isEmpty
()){
$week
=
count
(
$weekUsers
);
}
if
(
!
$monthUsers
->
isEmpty
()){
$month
=
count
(
$monthUsers
);
}
$date
=
[
'昨日新增用户占比'
=>
$dayUser
,
'上一周新增用户占比'
=>
$weekUser
,
'上一个月新增用户占比'
=>
$monthUser
];
$dayUser
=
ceil
(
$day
/
$users
*
100
);
$weekUser
=
ceil
(
$week
/
$users
*
100
)
;
$monthUser
=
ceil
(
$month
/
$users
*
100
)
;
$date
=
[
'昨日新增用户占比'
=>
$dayUser
,
'上一周新增用户占比'
=>
$weekUser
,
'上一个月新增用户占比'
=>
$monthUser
];
}
return
$date
;
...
...
@@ -409,6 +411,8 @@ class StatisticsService implements StatisticsServiceContract
public
function
UserEngagement
()
{
$users
=
UserInfo
::
all
();
$data
=
[];
if
(
!
$users
->
isEmpty
()){
$group
=
0
;
$project
=
0
;
...
...
@@ -433,18 +437,18 @@ class StatisticsService implements StatisticsServiceContract
}
}
}
}
// 获取全部用户
$userCount
=
count
(
$users
);
$engagementGroup
=
ceil
(
$group
/
$userCount
*
100
);
$engagementProject
=
ceil
(
$project
/
$userCount
*
100
);
$engagementTask
=
ceil
(
$task
/
$userCount
*
100
);
$engagementSchedule
=
ceil
(
$schedule
/
$userCount
*
100
);
$engagementBoard
=
ceil
(
$board
/
$userCount
*
100
);
$data
=
[
'团队'
=>
$engagementGroup
,
'项目'
=>
$engagementProject
,
'任务'
=>
$engagementTask
,
'日程'
=>
$engagementSchedule
,
'看板'
=>
$engagementBoard
];
// 获取全部用户
$userCount
=
count
(
$users
);
$engagementGroup
=
ceil
(
$group
/
$userCount
*
100
);
$engagementProject
=
ceil
(
$project
/
$userCount
*
100
);
$engagementTask
=
ceil
(
$task
/
$userCount
*
100
);
$engagementSchedule
=
ceil
(
$schedule
/
$userCount
*
100
);
$engagementBoard
=
ceil
(
$board
/
$userCount
*
100
);
$data
=
[
'团队'
=>
$engagementGroup
,
'项目'
=>
$engagementProject
,
'任务'
=>
$engagementTask
,
'日程'
=>
$engagementSchedule
,
'看板'
=>
$engagementBoard
];
}
return
$data
;
}
...
...
resources/views/admin/index.blade.php
View file @
1a33d389
...
...
@@ -215,12 +215,17 @@
url
:
'{{route('
statistics
.
UserIncrease
')}}'
,
success
:
function
(
data
){
//console.log(data);
$
(
'#day'
)
.
html
(
data
[
'昨日新增用户占比'
]
+
'%'
);
$
(
'#week'
)
.
html
(
data
[
'上一周新增用户占比'
]
+
'%'
);
$
(
'#month'
)
.
html
(
data
[
'上一个月新增用户占比'
]
+
'%'
);
if
(
data
==
''
){
//console.log('用户数据暂无')
$
(
'#day'
)
.
html
(
'数据暂无'
);
$
(
'#week'
)
.
html
(
'数据暂无'
);
$
(
'#month'
)
.
html
(
'数据暂无'
);
}
else
{
$
(
'#day'
)
.
html
(
data
[
'昨日新增用户占比'
]
+
'%'
);
$
(
'#week'
)
.
html
(
data
[
'上一周新增用户占比'
]
+
'%'
);
$
(
'#month'
)
.
html
(
data
[
'上一个月新增用户占比'
]
+
'%'
);
}
},
error
:
function
(
data
){
console
.
log
(
'错误'
);
...
...
@@ -235,8 +240,10 @@
type
:
'get'
,
url
:
"
{
{route('statistics.Total')}
}
"
,
success
:
function
(
data
){
//console.log(data);
optiona
[
'legend'
][
'data'
]
=
data
[
0
];
optiona
[
'series'
][
0
][
'data'
]
=
data
[
1
];
optiona
[
'series'
][
0
][
'data'
]
=
data
[
1
];
console
.
log
(
optiona
[
'series'
]);
myChart
.
setOption
(
optiona
);
...
...
@@ -248,25 +255,25 @@
})
}
retention_time
();
function
retention_time
(){
$
.
ajax
({
type
:
'get'
,
url
:
"
{
{route('statistics.RetentionTime')}
}
"
,
success
:
function
(
data
){
{{
--
retention_time
();
--
}}
{{
--
function
retention_time
(){
--
}}
{{
--
$
.
ajax
({
--
}}
{{
--
type
:
'get'
,
--
}}
{{
--
url
:
"
{
{route('statistics.RetentionTime')}}",--}
}
{
{--success:function(data){--}
}
//console.log(data);
page_retention_time
[
'legend'
][
'data'
]
=
data
[
0
];
page_retention_time
[
'series'
][
0
][
'data'
]
=
data
[
1
];
{
{--//console.log(data);--}
}
{{--page_retention_time['legend']['data'] = data[0];--}}
{{--page_retention_time['series'][0]['data']= data[1];--}}
page_retention_time_myChart
.
setOption
(
page_retention_time
);
{
{--page_retention_time_myChart.setOption(page_retention_time);--}
}
},
error
:
function
(
data
)
{
console
.
log
(
data
);
}
})
}
{
{--},--}
}
{{--error:function (data)
{
--}
}
{
{--console.log(data);--}
}
{
{--}--}
}
{
{--})--}
}
{
{--}--}
}
user_engagement();
...
...
@@ -275,10 +282,19 @@
type: 'get',
url: "
{{
route
(
'statistics.UserEngagement'
)}}
",
success:function(data){
axisData
=
data
[
0
]
option_user_engagement
[
'xAxis'
][
0
][
'data'
]
=
data
[
0
];
option_user_engagement
[
'series'
][
0
][
'data'
]
=
data
[
1
];
user_engagement_myChart
.
setOption
(
option_user_engagement
);
if(data==''){
console.log('参与度数据暂无')
}else {
axisData = data[0]
option_user_engagement['xAxis'][0]['data'] = data[0];
option_user_engagement['series'][0]['data'] = data[1];
user_engagement_myChart.setOption(option_user_engagement);
}
},
error:function (data) {
...
...
routes/web.php
View file @
1a33d389
...
...
@@ -84,7 +84,7 @@ Route::get('/',function (){return view('login');})->name('admin.login');
Route
::
get
(
'return_visit'
,
'StatisticsController@ReturnVisit'
)
->
name
(
'statistics.ReturnVisit'
);
Route
::
get
(
'user_retention'
,
'StatisticsController@UserRetention'
)
->
name
(
'statistics.UserRetention'
);
Route
::
get
(
'average_user_operation'
,
'StatisticsController@AverageUserOperation'
)
->
name
(
'statistics.AverageUserOperation'
);
Route
::
get
(
'retention_time'
,
'StatisticsController@RetentionTime'
)
->
name
(
'statistics.RetentionTime'
);
//
Route::get('retention_time','StatisticsController@RetentionTime')->name('statistics.RetentionTime');
Route
::
get
(
'new_user'
,
'StatisticsController@NewUsers'
)
->
name
(
'statistics.NewUser'
);
Route
::
get
(
'user_engagement'
,
'StatisticsController@UserEngagement'
)
->
name
(
'statistics.UserEngagement'
);
Route
::
get
(
'total'
,
'StatisticsController@Total'
)
->
name
(
'statistics.Total'
);
...
...
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