Commit a131f336 authored by Mirzat's avatar Mirzat 🤕

Merge branch 'dev-master' of 120.27.221.179:gxx123/workbiu-admin into dev-master

parents 231d419c b5f1fcaa
...@@ -18,16 +18,16 @@ class AdminController extends Controller ...@@ -18,16 +18,16 @@ class AdminController extends Controller
} }
public function login(Request $request) public function login($email,$password)
{ {
$email = $request->email;
$password = $request->password;
$admin = $this->mAdmin->login($email,$password);
//$email = $request->email;
//$password = $request->password;
$admin = $this->mAdmin->login($email,$password);
if($admin){ if($admin){
return redirect(route('/')); return 1;
}else{ }else{
return redirect()->back(); return 0;
} }
} }
...@@ -148,6 +148,20 @@ class AdminController extends Controller ...@@ -148,6 +148,20 @@ class AdminController extends Controller
public function adminInfo()
{
$session = session()->get('admin');
if ($session==null){
return null;
}
if ($session->get_role != null){
unset($session->get_role);
}
return $session;
}
public function test() public function test()
{ {
dd($_SERVER); dd($_SERVER);
......
...@@ -301,126 +301,76 @@ class StatisticsService implements StatisticsServiceContract ...@@ -301,126 +301,76 @@ class StatisticsService implements StatisticsServiceContract
public function PageRetentionTime() public function PageRetentionTime()
{ {
$userInfo = UserInfo::all(); $userInfo = UserInfo::all();
$this-> userCount = count($userInfo); if(!$userInfo->isEmpty()){
if(!$userInfo->isEmpty()) { $a =0;$b=0;$c=0;$d=0;$e=0;$f=0;$g=0;$h=0;$i=0;$j=0;$k=0;$l=0;$m=0;$n=0;$o=0;$p=0;
$arr =[]; foreach ($userInfo as $info){
foreach ($userInfo as $info) { if(count(json_decode($info['page_retention_time'])) >0 ){
if (count(json_decode($info['page_retention_time'])) > 0) {
$pageTime = json_decode($info['page_retention_time']); $pageTime = json_decode($info['page_retention_time']);
foreach ($pageTime as $k=> $page) { foreach ($pageTime as $page){
if($page->id == 1){
$arr[] = $page; $a += $page->time;
}if($page->id == 2){
$b += $page->time;
}if($page->id == 3){
$c += $page->time;
}if($page->id == 4){
$d += $page->time;
}if($page->id == 5){
$e += $page->time;
}if($page->id == 6){
$f += $page->time;
}if($page->id == 7){
$g += $page->time;
}if($page->id == 8){
$h += $page->time;
}if($page->id == 9){
$i += $page->time;
}if($page->id == 10){
$j += $page->time;
}if($page->id == 11){
$k += $page->time;
}if($page->id == 12){
$l += $page->time;
}if($page->id == 13){
$m += $page->time;
}if($page->id == 14){
$n += $page->time;
}if($page->id == 15){
$o += $page->time;
}if($page->id == 16){
$p += $page->time;
}
} }
} }
} }
}
return 1;
// 获取全部用户
$userCount = UserInfo::all()->count();
$invitation = ceil($a / $userCount);
$timeline = ceil($b / $userCount);
$project = ceil($c / $userCount);
$filemanage = ceil($d / $userCount);
$mine = ceil($e / $userCount);
$company = ceil($f / $userCount);
$myteam = ceil($g / $userCount);
$mission = ceil($h / $userCount);
$project_item = ceil($i / $userCount);
$login = ceil($j / $userCount);
$register = ceil($k / $userCount);
$discussion = ceil($l / $userCount);
$mission_settings = ceil($m / $userCount);
$search_team = ceil($n / $userCount);
$bangding_phone = ceil($o / $userCount);
$search_user = ceil($p / $userCount);
$data =['invitation'=>$invitation,'timeline'=>$timeline,'project'=>$project,'filemanage'=>$filemanage,'mine'=>$mine,'company'=>$company,'myteam'=>$myteam,'mission'=>$mission,'project_item'=>$project_item,'login'=>$login,'register'=>$register,'discussion'=>$discussion,'mission_settings'=>$mission_settings,'search_team'=>$search_team,'bangding_phone'=>$bangding_phone
,'search_user'=>$search_user];
return $data;
}
// $userInfo = UserInfo::all();
// if(!$userInfo->isEmpty()){
// $a =0;$b=0;$c=0;$d=0;$e=0;$f=0;$g=0;$h=0;$i=0;$j=0;$k=0;$l=0;$m=0;$n=0;$o=0;$p=0;
// foreach ($userInfo as $info){
// if(count(json_decode($info['page_retention_time'])) >0 ){
// $pageTime = json_decode($info['page_retention_time']);
// foreach ($pageTime as $page){
// if($page->id == 1){
// $a += $page->time;
// }if($page->id == 2){
// $b += $page->time;
// }if($page->id == 3){
// $c += $page->time;
// }if($page->id == 4){
// $d += $page->time;
// }if($page->id == 5){
// $e += $page->time;
// }if($page->id == 6){
// $f += $page->time;
// }if($page->id == 7){
// $g += $page->time;
// }if($page->id == 8){
// $h += $page->time;
// }if($page->id == 9){
// $i += $page->time;
// }if($page->id == 10){
// $j += $page->time;
// }if($page->id == 11){
// $k += $page->time;
// }if($page->id == 12){
// $l += $page->time;
// }if($page->id == 13){
// $m += $page->time;
// }if($page->id == 14){
// $n += $page->time;
// }if($page->id == 15){
// $o += $page->time;
// }if($page->id == 16){
// $p += $page->time;
// }
//
// }
// }
// }
//
// // 获取全部用户
// $userCount = UserInfo::all()->count();
//
// $invitation = ceil($a / $userCount);
// $timeline = ceil($b / $userCount);
// $project = ceil($c / $userCount);
// $filemanage = ceil($d / $userCount);
// $mine = ceil($e / $userCount);
// $company = ceil($f / $userCount);
// $myteam = ceil($g / $userCount);
// $mission = ceil($h / $userCount);
// $project_item = ceil($i / $userCount);
// $login = ceil($j / $userCount);
// $register = ceil($k / $userCount);
// $discussion = ceil($l / $userCount);
// $mission_settings = ceil($m / $userCount);
// $search_team = ceil($n / $userCount);
// $bangding_phone = ceil($o / $userCount);
// $search_user = ceil($p / $userCount);
//
// $data =['invitation'=>$invitation,'timeline'=>$timeline,'project'=>$project,'filemanage'=>$filemanage,'mine'=>$mine,'company'=>$company,'myteam'=>$myteam,'mission'=>$mission,'project_item'=>$project_item,'login'=>$login,'register'=>$register,'discussion'=>$discussion,'mission_settings'=>$mission_settings,'search_team'=>$search_team,'bangding_phone'=>$bangding_phone
// ,'search_user'=>$search_user];
// return $data;
// }
} }
// 新用户 // 新用户
......
<?php
use Illuminate\Database\Seeder;
class AdminsTableSeeder extends Seeder
{
/**
* Auto generated seed file
*
* @return void
*/
public function run()
{
\DB::table('admins')->delete();
\DB::table('admins')->insert(array (
0 =>
array (
'id' => 1,
'email' => '243818853@qq.com',
'password' => '$2y$10$bhm6QIRumyzrkh2HWJzmu.lC.DAno4J8twWOMsw6kdi1UW0aQRc66',
'created_at' => '2017-11-28 15:57:57',
'updated_at' => '2017-11-28 15:57:57',
'name' => 'gxx',
),
1 =>
array (
'id' => 13,
'email' => '111@qq.com',
'password' => '$2y$10$msj6uX3OIt8twBJXiF3odOP10nHlXRBfsUkS4io4C42y2Ijz108b.',
'created_at' => '2017-11-29 16:06:22',
'updated_at' => '2017-11-29 16:57:23',
'name' => 'ggggggg1',
),
2 =>
array (
'id' => 14,
'email' => '123@qq.com',
'password' => '$2y$10$dI68SrPLGXTZJb6LmJL1yOrt3FBCrsBRKhvGzdPAn1dKIjyi/j.P2',
'created_at' => '2017-11-29 17:21:07',
'updated_at' => '2017-11-29 17:21:07',
'name' => '222',
),
3 =>
array (
'id' => 15,
'email' => '333@qq.com',
'password' => '$2y$10$rFXWglvtXeuh3SfgzfMKB.VgyJF5toXDR9OMgBzVU1K9tydje7r.O',
'created_at' => '2017-11-29 18:07:17',
'updated_at' => '2017-11-29 18:07:17',
'name' => 'gq',
),
));
}
}
\ No newline at end of file
...@@ -14,5 +14,9 @@ class DatabaseSeeder extends Seeder ...@@ -14,5 +14,9 @@ class DatabaseSeeder extends Seeder
// $this->call(UsersTableSeeder::class); // $this->call(UsersTableSeeder::class);
$this->call(UserInfosTableSeeder::class); $this->call(UserInfosTableSeeder::class);
$this->call(PermissionsTableSeeder::class); $this->call(PermissionsTableSeeder::class);
$this->call(AdminsTableSeeder::class);
$this->call(RolesTableSeeder::class);
$this->call(RoleAdminsTableSeeder::class);
$this->call(PermissionRoleTableSeeder::class);
} }
} }
<?php
use Illuminate\Database\Seeder;
class PermissionRoleTableSeeder extends Seeder
{
/**
* Auto generated seed file
*
* @return void
*/
public function run()
{
\DB::table('permission_role')->delete();
\DB::table('permission_role')->insert(array (
0 =>
array (
'permission_id' => 1,
'role_id' => 1,
),
1 =>
array (
'permission_id' => 1,
'role_id' => 2,
),
2 =>
array (
'permission_id' => 2,
'role_id' => 1,
),
3 =>
array (
'permission_id' => 2,
'role_id' => 6,
),
4 =>
array (
'permission_id' => 3,
'role_id' => 1,
),
5 =>
array (
'permission_id' => 3,
'role_id' => 5,
),
6 =>
array (
'permission_id' => 4,
'role_id' => 1,
),
7 =>
array (
'permission_id' => 4,
'role_id' => 3,
),
8 =>
array (
'permission_id' => 5,
'role_id' => 1,
),
9 =>
array (
'permission_id' => 5,
'role_id' => 4,
),
10 =>
array (
'permission_id' => 6,
'role_id' => 1,
),
));
}
}
\ No newline at end of file
<?php
use Illuminate\Database\Seeder;
class RoleAdminsTableSeeder extends Seeder
{
/**
* Auto generated seed file
*
* @return void
*/
public function run()
{
\DB::table('role_admins')->delete();
\DB::table('role_admins')->insert(array (
0 =>
array (
'id' => 84,
'admin_id' => 1,
'role_id' => 1,
),
1 =>
array (
'id' => 83,
'admin_id' => 14,
'role_id' => 3,
),
2 =>
array (
'id' => 97,
'admin_id' => 15,
'role_id' => 2,
),
));
}
}
\ No newline at end of file
<?php
use Illuminate\Database\Seeder;
class RolesTableSeeder extends Seeder
{
/**
* Auto generated seed file
*
* @return void
*/
public function run()
{
\DB::table('roles')->delete();
\DB::table('roles')->insert(array (
0 =>
array (
'id' => 1,
'name' => 'surper_admin',
'display_name' => '超级管理员',
'description' => '拥有最大权限',
'created_at' => '2017-11-28 19:12:23',
'updated_at' => '2017-11-28 19:12:25',
),
1 =>
array (
'id' => 2,
'name' => 'aaadmin',
'display_name' => '用户管理',
'description' => '拥有对用户模块所有权限',
'created_at' => '2017-11-29 14:25:25',
'updated_at' => '2017-11-29 17:02:40',
),
2 =>
array (
'id' => 3,
'name' => 'files',
'display_name' => '文件的管理员呐',
'description' => '阿德',
'created_at' => '2017-11-29 15:35:15',
'updated_at' => '2017-11-29 15:35:15',
),
3 =>
array (
'id' => 4,
'name' => 'quanxian',
'display_name' => '权限管理员呐1',
'description' => '13',
'created_at' => '2017-11-29 15:36:00',
'updated_at' => '2017-11-29 15:36:00',
),
4 =>
array (
'id' => 5,
'name' => 'statistics',
'display_name' => '统计模块管理员',
'description' => '12312',
'created_at' => '2017-11-29 18:10:04',
'updated_at' => '2017-11-29 18:10:04',
),
5 =>
array (
'id' => 6,
'name' => 'group',
'display_name' => '团队模块管理',
'description' => '团队模块管理员',
'created_at' => '2017-11-29 18:24:51',
'updated_at' => '2017-11-29 18:24:51',
),
));
}
}
\ No newline at end of file
...@@ -80,58 +80,6 @@ ...@@ -80,58 +80,6 @@
<!-- Button trigger modal -->
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">添加新的权限</h4>
</div>
<div class="modal-body">
<!-- /.box-header -->
<!-- form start -->
<form action="{{route('login')}}">
<div class="box-body">
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">权限名: &nbsp;&nbsp;</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputEmail3" placeholder="name">
</div>
</div>
<div class="form-group">
<label for="inputPassword3" class="col-sm-2 control-label">功能:&nbsp;</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputPassword3" placeholder="display_name">
</div>
</div>
<div class="form-group">
<label for="inputPassword3" class="col-sm-2 control-label">介绍: &nbsp;</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputPassword3" placeholder="description">
</div>
</div>
<!-- /.box-body -->
<!-- /.box-footer -->
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary">保存</button>
</div>
</div>
</div>
</div>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<img src=" {{asset('/bower_components/AdminLTE/dist/img/user2-160x160.jpg')}} " class="img-circle" alt="User Image"> <img src=" {{asset('/bower_components/AdminLTE/dist/img/user2-160x160.jpg')}} " class="img-circle" alt="User Image">
</div> </div>
<div class="pull-left info"> <div class="pull-left info">
<p>Geng xingxign</p> <p id="name"></p>
<!-- Status --> <!-- Status -->
<a href="#"><i class="fa fa-circle text-success"></i> Online</a> <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
</div> </div>
...@@ -128,4 +128,32 @@ ...@@ -128,4 +128,32 @@
<!-- /.sidebar-menu --> <!-- /.sidebar-menu -->
</section> </section>
<!-- /.sidebar --> <!-- /.sidebar -->
</aside> </aside>
\ No newline at end of file
<script src="{{url('js/jquery-3.2.1.min.js')}}"> </script>
<script>
$.ajax({
type:'get',
//url:' /' + search ,
url:'{{route('getAdminInfo')}}' ,
success:function(data){
if(data['name']){
$('#name').text(data['name']);
}
},
error:function(data){
console.log('错误');
}
})
</script>
\ No newline at end of file
...@@ -27,23 +27,24 @@ ...@@ -27,23 +27,24 @@
<body class="hold-transition login-page"> <body class="hold-transition login-page">
<div class="login-box"> <div class="login-box">
<div class="login-logo"> <div class="login-logo">
<a href="../../index2.html"><b>Workbiu</b>-Admin</a> <a href="#"><b>Workbiu</b>-Admin</a>
</div> </div>
<!-- /.login-logo --> <!-- /.login-logo -->
<div class="login-box-body"> <div class="login-box-body">
<p class="login-box-msg">Sign in to start your session</p> <p class="login-box-msg">Sign in to start your session</p>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<form action="{{route('login')}}" method="post" > {{--<form action="{{route('login')}}" method="post" >--}}
{{csrf_field()}} {{--{{csrf_field()}}--}}
<input type="email" class="form-control" placeholder="Email" name="email"> <input type="email" class="form-control" placeholder="Email" name="email" id="email">
<span class="glyphicon glyphicon-envelope form-control-feedback"></span> <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<input type="password" class="form-control" placeholder="Password" name="password"> <input type="password" class="form-control" placeholder="Password" name="password" id="password">
<span class="glyphicon glyphicon-lock form-control-feedback"></span> <span class="glyphicon glyphicon-lock form-control-feedback"></span>
<p style="font-family: 微软雅黑;color: #cb2027" hidden id="p"> * 账号或密码错误 </p>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-8"> <div class="col-xs-8">
...@@ -55,7 +56,7 @@ ...@@ -55,7 +56,7 @@
</div> </div>
<!-- /.col --> <!-- /.col -->
<div class="col-xs-4"> <div class="col-xs-4">
<button type="submit" class="btn btn-primary btn-block btn-flat">Sign In</button> <button type="submit" class="btn btn-primary btn-block btn-flat" id="tijiao"> 登 陆 </button>
</div> </div>
<!-- /.col --> <!-- /.col -->
...@@ -63,7 +64,7 @@ ...@@ -63,7 +64,7 @@
</form> {{--</form>--}}
...@@ -83,6 +84,63 @@ ...@@ -83,6 +84,63 @@
<script> <script>
$('#tijiao').click(function () {
var email = document.getElementById('email').value;
var password = document.getElementById('password').value;
if (email == ''){
alert('邮箱不能为空');
}
if (password == ''){
alert('密码不能为空');
}
if(email != '' && password != ''){
$.ajax({
type:'get',
url:'{{url('login')}}/' + email + '/'+ password,
success:function(data){
if(data==1){
window.location.href = "{{route('/')}}";
}else{
$('#p').attr('hidden',false);
}
},
error:function(data){
console.log('无法预知的错误');
}
})
}
console.log(name);
})
// $.ajax({
// type:'get',
// //url:' /' + search ,
// url:'' ,
// success:function(data){
// if(data['name']){
// $('#name').text(data['name']);
// }
//
// },
// error:function(data){
// console.log('错误');
// }
// })
$(document).ready(function () { $(document).ready(function () {
//alert(1) //alert(1)
...@@ -93,13 +151,13 @@ ...@@ -93,13 +151,13 @@
$(function () { // $(function () {
$('input').iCheck({ // $('input').iCheck({
checkboxClass: 'icheckbox_square-blue', // checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue', // radioClass: 'iradio_square-blue',
increaseArea: '20%' // optional // increaseArea: '20%' // optional
}); // });
}); // });
</script> </script>
</body> </body>
</html> </html>
...@@ -11,10 +11,8 @@ ...@@ -11,10 +11,8 @@
| |
*/ */
// //
//Route::get('/', function () {
// return view('admin/dashboard');
//});
// 登陆页面
Route::get('/',function (){return view('login');})->name('admin.login'); Route::get('/',function (){return view('login');})->name('admin.login');
Route::group(['prefix'=>'error'],function (){ Route::group(['prefix'=>'error'],function (){
...@@ -30,7 +28,7 @@ Route::get('/',function (){return view('login');})->name('admin.login'); ...@@ -30,7 +28,7 @@ Route::get('/',function (){return view('login');})->name('admin.login');
}); });
Route::post('login','AdminController@login')->name('login'); Route::get('login/{email}/{password}','AdminController@login')->name('login');
route::get('logout','AdminController@logout')->name('logout'); route::get('logout','AdminController@logout')->name('logout');
//admin //admin
...@@ -40,6 +38,7 @@ Route::get('/',function (){return view('login');})->name('admin.login'); ...@@ -40,6 +38,7 @@ Route::get('/',function (){return view('login');})->name('admin.login');
route::get('get_all','AdminController@getAll')->name('admin.getAll'); route::get('get_all','AdminController@getAll')->name('admin.getAll');
route::get('update_page','AdminController@updatePage')->name('admin.updatePage'); route::get('update_page','AdminController@updatePage')->name('admin.updatePage');
route::post('update','AdminController@update')->name('admin.update'); route::post('update','AdminController@update')->name('admin.update');
route::get('get_admin_info','AdminController@adminInfo')->name('getAdminInfo');
}); });
// 用户 // 用户
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment