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
cc169ef1
Commit
cc169ef1
authored
Nov 11, 2017
by
gxx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成用户增长百分比显示在页面
parent
cc2beae6
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
75413 additions
and
2 deletions
+75413
-2
StatisticsServiceContract.php
app/Contracts/StatisticsServiceContract.php
+17
-0
GroupController.php
app/Http/Controllers/GroupController.php
+1
-1
StatisticsController.php
app/Http/Controllers/StatisticsController.php
+14
-0
UserInfo.php
app/Models/UserInfo.php
+10
-0
StatisticsServiceProvider.php
app/Providers/StatisticsServiceProvider.php
+33
-0
StatisticsService.php
app/Services/StatisticsService.php
+49
-0
UploadPhoto.php
app/Util/UploadPhoto.php
+53
-0
app.php
config/app.php
+1
-0
2017_11_11_114717_create_user_infos_table.php
.../migrations/2017_11_11_114717_create_user_infos_table.php
+31
-0
echarts.js
public/js/echarts.js
+75069
-0
index.blade.php
resources/views/admin/index.blade.php
+120
-0
update.blade.php
resources/views/admin/user/update.blade.php
+1
-1
web.php
routes/web.php
+14
-0
No files found.
app/Contracts/StatisticsServiceContract.php
0 → 100644
View file @
cc169ef1
<?php
/**
* Created by PhpStorm.
* User: Aladin
* Date: 2017/11/10
* Time: 16:14
*/
namespace
App\Contracts
;
interface
StatisticsServiceContract
{
public
function
UserIncrease
();
}
\ No newline at end of file
app/Http/Controllers/GroupController.php
View file @
cc169ef1
...
@@ -195,7 +195,7 @@ class GroupController extends Controller
...
@@ -195,7 +195,7 @@ class GroupController extends Controller
if
(
$inviteResult
){
if
(
$inviteResult
){
return
Message
::
makeSuccess
(
'邀请成功!'
);
return
Message
::
makeSuccess
(
'邀请成功!'
);
}
else
{
}
else
{
return
Message
::
makeError
(
'
你邀请过了吧
!'
);
return
Message
::
makeError
(
'
ta 已经是你的人了,亲
!'
);
}
}
}
}
...
...
app/Http/Controllers/StatisticsController.php
View file @
cc169ef1
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
App\Http\Controllers
;
namespace
App\Http\Controllers
;
use
App\Contracts\StatisticsServiceContract
;
use
App\Models\Group
;
use
App\Models\Group
;
use
App\Models\Project
;
use
App\Models\Project
;
use
App\Models\User
;
use
App\Models\User
;
...
@@ -11,6 +12,11 @@ use Illuminate\Http\Request;
...
@@ -11,6 +12,11 @@ use Illuminate\Http\Request;
class
StatisticsController
extends
Controller
class
StatisticsController
extends
Controller
{
{
public
function
__construct
(
StatisticsServiceContract
$statisticsHandel
)
{
$this
->
mStatistics
=
$statisticsHandel
;
}
// 今日新增用户
// 今日新增用户
public
function
newUser
()
public
function
newUser
()
...
@@ -34,4 +40,12 @@ class StatisticsController extends Controller
...
@@ -34,4 +40,12 @@ class StatisticsController extends Controller
}
}
// 用户增长
public
function
UserIncrease
()
{
$date
=
$this
->
mStatistics
->
UserIncrease
();
return
$date
;
}
}
}
app/Models/UserInfo.php
0 → 100644
View file @
cc169ef1
<?php
namespace
App\Models
;
use
Illuminate\Database\Eloquent\Model
;
class
UserInfo
extends
Model
{
//
}
app/Providers/StatisticsServiceProvider.php
0 → 100644
View file @
cc169ef1
<?php
namespace
App\Providers
;
use
App\Services\StatisticsService
;
use
Illuminate\Support\ServiceProvider
;
class
StatisticsServiceProvider
extends
ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public
function
boot
()
{
//
}
/**
* Register the application services.
*
* @return void
*/
public
function
register
()
{
//绑定服务与接口关系
$this
->
app
->
singleton
(
"App\Contracts\StatisticsServiceContract"
,
function
(){
return
new
StatisticsService
();
});
}
}
app/Services/StatisticsService.php
0 → 100644
View file @
cc169ef1
<?php
/**
* Created by PhpStorm.
* User: Aladin
* Date: 2017/11/10
* Time: 16:16
*/
namespace
App\Services
;
use
App\Contracts\StatisticsServiceContract
;
use
App\Models\User
;
use
Carbon\Carbon
;
class
StatisticsService
implements
StatisticsServiceContract
{
public
function
UserIncrease
()
{
$dtD
=
Carbon
::
now
()
->
subDay
();
$dtM
=
Carbon
::
now
()
->
subMonth
();
$dtW
=
Carbon
::
now
()
->
subWeek
();
$dayUsers
=
User
::
where
(
'created_at'
,
'>'
,
$dtD
)
->
get
();
$monthUsers
=
User
::
where
(
'created_at'
,
'>'
,
$dtM
)
->
get
();
$weekUsers
=
User
::
where
(
'created_at'
,
'>'
,
$dtW
)
->
get
();
$users
=
User
::
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
);
}
$day
=
round
(
$day
/
$users
*
100
,
2
);
$week
=
round
(
$week
/
$users
*
100
,
2
);
$month
=
round
(
$month
/
$users
*
100
,
2
);
$date
=
array
(
$day
.
'%'
,
$week
.
'%'
,
$month
.
'%'
,
$users
);
return
$date
;
}
}
\ No newline at end of file
app/Util/UploadPhoto.php
0 → 100644
View file @
cc169ef1
<?php
/**
* Created by PhpStorm.
* User: Aladin
* Date: 2017/9/27
* Time: 17:28
*/
namespace
App\Util
;
use
Illuminate\Support\Facades\Storage
;
class
UploadPhoto
{
public
function
upload
(
$head_icon
)
{
// 获取上传文件的大小
$size
=
$head_icon
->
getSize
();
if
(
$size
>
2
*
1024
*
1024
){
return
back
()
->
with
(
'上传文件不能超过2M'
);
}
// 文件类型
$mimeType
=
$head_icon
->
getMimeType
();
// 扩展文件名
$ext
=
$head_icon
->
getClientOriginalExtension
();
// 判断是否通过HTTP POST 上传
$realPath
=
$head_icon
->
getRealPath
();
if
(
!
$realPath
){
return
'操作非法'
;
}
$today
=
date
(
'Y-m-d'
);
$dir
=
storage_path
()
.
'\app\public\uploads\\'
.
$today
;
if
(
!
$dir
){
mkdir
(
$dir
);
}
// 新文件名
$newFilename
=
uniqid
()
.
'.'
.
$ext
;
if
(
Storage
::
disk
(
'uploads'
)
->
put
(
$today
.
'/'
.
$newFilename
,
file_get_contents
(
$realPath
))){
$head_icon
=
'storage/'
.
$today
.
'/'
.
$newFilename
;
return
$head_icon
;
}
else
{
return
false
;
}
}
}
\ No newline at end of file
config/app.php
View file @
cc169ef1
...
@@ -183,6 +183,7 @@ return [
...
@@ -183,6 +183,7 @@ return [
App\Providers\ScheduleServiceProvider
::
class
,
App\Providers\ScheduleServiceProvider
::
class
,
App\Providers\SMSServiceProvider
::
class
,
App\Providers\SMSServiceProvider
::
class
,
App\Providers\UserServiceProvider
::
class
,
App\Providers\UserServiceProvider
::
class
,
App\Providers\StatisticsServiceProvider
::
class
,
Zizaco\Entrust\EntrustServiceProvider
::
class
,
Zizaco\Entrust\EntrustServiceProvider
::
class
,
...
...
database/migrations/2017_11_11_114717_create_user_infos_table.php
0 → 100644
View file @
cc169ef1
<?php
use
Illuminate\Support\Facades\Schema
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
class
CreateUserInfosTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'user_infos'
,
function
(
Blueprint
$table
)
{
$table
->
increments
(
'id'
);
$table
->
timestamps
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'user_infos'
);
}
}
public/js/echarts.js
0 → 100644
View file @
cc169ef1
This diff is collapsed.
Click to expand it.
resources/views/admin/index.blade.php
View file @
cc169ef1
...
@@ -67,5 +67,125 @@
...
@@ -67,5 +67,125 @@
<!--
./
col
-->
<!--
./
col
-->
</
div
>
</
div
>
<
div
>
{{
--<
div
style
=
"width: 728px;height: 200px;background-color: #f0f0f0;border: 1px solid #D2D6DE;float: right;"
>--
}}
<
div
style
=
"width: 815px;height: 200px;background-color: #f0f0f0;border: 1px solid #D2D6DE;float: right;"
>
<
p
style
=
"margin-left: 265px;"
>
新增用户占总用户百分比数据图
</
p
>
<
div
style
=
"width: 220px;height: 150px;float: left; margin-top:2px;margin-left: 15px; line-height: 150px;"
>
昨日新增用户数
:
<
span
style
=
"font-family:'微软雅黑';font-size: 20px;color: #cb2027;"
id
=
"day"
>
</
span
>
</
div
>
<
div
style
=
"float:left;width: 1px;height: 120px; background: #A3A3A3;margin-top: 21px;"
></
div
>
<
div
style
=
"width: 220px;height: 150px;float: left; margin-top: 2px;margin-left: 15px;line-height: 150px;"
>
一周内新增用户数
:
<
span
style
=
"font-family:'微软雅黑';font-size: 20px;color: #cb2027;"
id
=
"week"
>
</
span
>
</
div
>
<
div
style
=
"float:left;width: 1px;height: 120px; background: #A3A3A3;margin-top: 21px;"
></
div
>
<
div
style
=
"width: 220px;height: 150px;float: left; margin-top: 2px;margin-left: 15px;line-height: 150px;"
>
一月内新增用户数
:
<
span
style
=
"font-family:'微软雅黑';font-size: 20px;color: #cb2027;"
id
=
"month"
>
</
span
>
</
div
>
<!--
为ECharts准备一个具备大小
(
宽高
)
的Dom
-->
</
div
>
<
div
id
=
"main"
style
=
"width: 600px;height:400px;"
></
div
>
</
div
>
<
script
src
=
"
{
{url('js/jquery-3.2.1.min.js')}
}
"
>
</
script
>
<!--
引入
echarts
.
js
-->
<
script
src
=
"
{
{'js/echarts.js'}
}
"
></
script
>
<
script
>
$
.
ajax
({
type
:
'get'
,
url
:
'{{route('
statistics
.
UserIncrease
')}}'
,
success
:
function
(
data
){
$
(
'#day'
)
.
html
(
data
[
0
]);
$
(
'#week'
)
.
html
(
data
[
1
]);
$
(
'#month'
)
.
html
(
data
[
2
]);
},
error
:
function
(
data
){
console
.
log
(
'错误'
);
}
});
// 基于准备好的dom,初始化echarts实例
var
myChart
=
echarts
.
init
(
document
.
getElementById
(
'main'
));
var
optiona
=
{
tooltip
:
{
trigger
:
'item'
,
formatter
:
"
{
a
}
<br/>
{
b
}
:
{
c
}
(
{
d
}
%)"
},
legend
:
{
orient
:
'vertical'
,
x
:
'left'
,
data
:
[
'直接访问'
,
'邮件营销'
,
'联盟广告'
,
'视频广告'
,
'搜索引擎'
]
},
series
:
[
{
name
:
'访问来源'
,
type
:
'pie'
,
radius
:
[
'50%'
,
'70%'
],
avoidLabelOverlap
:
false
,
label
:
{
normal
:
{
show
:
false
,
position
:
'center'
},
emphasis
:
{
show
:
true
,
textStyle
:
{
fontSize
:
'30'
,
fontWeight
:
'bold'
}
}
},
labelLine
:
{
normal
:
{
show
:
false
}
},
data
:
[
{
value
:
335
,
name
:
'直接访问'
},
{
value
:
310
,
name
:
'邮件营销'
},
{
value
:
234
,
name
:
'联盟广告'
},
{
value
:
135
,
name
:
'视频广告'
},
{
value
:
1548
,
name
:
'搜索引擎'
}
]
}
]
};
myChart
.
setOption
(
optiona
);
</
script
>
@
endsection
@
endsection
\ No newline at end of file
resources/views/admin/user/update.blade.php
View file @
cc169ef1
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
<
label
for
=
"exampleInputFile"
>
头像
</
label
>
<
label
for
=
"exampleInputFile"
>
头像
</
label
>
<
p
>
<
p
>
<
img
src
=
"
{
{asset($result['head_icon'])}
}
"
alt
=
""
width
=
"100px"
height
=
"
8
0px"
style
=
"border-radius: 80%"
>
<
img
src
=
"
{
{asset($result['head_icon'])}
}
"
alt
=
""
width
=
"100px"
height
=
"
2
0px"
style
=
"border-radius: 80%"
>
</
p
>
</
p
>
</
div
>
</
div
>
<
div
class
=
"form-group"
>
<
div
class
=
"form-group"
>
...
...
routes/web.php
View file @
cc169ef1
...
@@ -78,6 +78,20 @@ Route::group(['prefix'=> 'project'],function (){
...
@@ -78,6 +78,20 @@ Route::group(['prefix'=> 'project'],function (){
});
});
// 统计
Route
::
group
([
'prefix'
=>
'statistics'
],
function
(){
Route
::
get
(
'user_increase'
,
'StatisticsController@UserIncrease'
)
->
name
(
'statistics.UserIncrease'
);
});
// 权限
// 权限
Route
::
group
([
'prefix'
=>
'auth'
],
function
(){
Route
::
group
([
'prefix'
=>
'auth'
],
function
(){
Route
::
get
(
'getAll'
,
'AuthController@getAll'
)
->
name
(
'auth.getAll'
);
Route
::
get
(
'getAll'
,
'AuthController@getAll'
)
->
name
(
'auth.getAll'
);
...
...
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