From 59665744604280042b1319e69497f14894aea4cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Mon, 7 Jan 2019 16:44:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Index.php | 27 +++- application/admin/model/Admin.php | 13 ++ application/admin/view/index/create.html | 14 ++ application/admin/view/index/edit.html | 14 ++ application/admin/view/index/index.html | 8 +- application/index/controller/Index.php | 12 +- application/index/view/index/welcome.html | 146 ++---------------- database/migrations/20181012140355_member.php | 1 + database/seeds/Admin.php | 2 + 9 files changed, 96 insertions(+), 141 deletions(-) diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php index 44561f15..462cbc2a 100644 --- a/application/admin/controller/Index.php +++ b/application/admin/controller/Index.php @@ -42,7 +42,11 @@ class Index extends Base //得到排序字段的下标 $order_column = $getdt['order'][0]['column']; //根据排序字段的下标得到排序字段 - $order_field = $getdt['columns'][$order_column]['data']; + $order_field = $getdt['columns'][$order_column]['name']; + if($order_field=='') + { + $order_field = $getdt['columns'][$order_column]['data']; + } //得到limit参数 $limit_start = $getdt['start']; $limit_length = $getdt['length']; @@ -52,8 +56,11 @@ class Index extends Base //查询数据 - $data = AD::field('id,xingming,sex,username,phone,shengri,denglucishu,status,create_time') + $data = AD::field('id,school,xingming,sex,username,phone,shengri,denglucishu,status,create_time') ->where('id','>','2') + ->with(['adSchool'=>function($query){ + $query->field('id,jiancheng'); + }]) ->order([$order_field=>$order]) ->limit($limit_start,$limit_length) ->select(); @@ -63,8 +70,11 @@ class Index extends Base // 如果需要查询 if($search){ - $data = AD::field('id,xingming,sex,username,phone,shengri,denglucishu,status,create_time') + $data = AD::field('id,school,xingming,sex,username,phone,shengri,denglucishu,status,create_time') ->where('id','>','1') + ->with(['adSchool'=>function($query){ + $query->field('jiancheng'); + }]) ->order([$order_field=>$order]) ->limit($limit_start,$limit_length) ->where('username|xingming','like','%'.$search.'%') @@ -116,7 +126,7 @@ class Index extends Base // 获取表单数据 - $list = request()->only(['xingming','username','sex','shengri','phone','beizhu','group_id'],'post'); + $list = request()->only(['xingming','school','username','sex','shengri','phone','beizhu','group_id'],'post'); // 设置密码,默认为123456 @@ -158,7 +168,7 @@ class Index extends Base { // 获取管理员信息 - $list = AD::get($id); + $list = AD::where('id',$id)->find(); // 模板赋值 $this->assign('list',$list); @@ -175,8 +185,9 @@ class Index extends Base { // 获取用户信息 - $list = AD::field('id,username,xingming,sex,shengri,phone,beizhu') - ->get($id); + $list = AD::where('id',$id) + ->field('id,school,username,xingming,sex,shengri,phone,beizhu') + ->find(); // 追加用户id字符串 $list = $list->append(['groupids']); @@ -195,7 +206,7 @@ class Index extends Base $validate = new \app\admin\validate\Admin; // 获取表单数据 - $list = request()->only(['xingming','username','sex','shengri','phone','beizhu','group_id'],'put'); + $list = request()->only(['xingming','school','username','sex','shengri','phone','beizhu','group_id'],'put'); // 验证表单数据 $result = $validate->check($list); diff --git a/application/admin/model/Admin.php b/application/admin/model/Admin.php index 9c41b543..f021d2e0 100644 --- a/application/admin/model/Admin.php +++ b/application/admin/model/Admin.php @@ -45,6 +45,13 @@ class Admin extends Base } + // 最后登录获取器 + public function getLasttimeAttr($value) + { + return date('Y年m月d日 h:i:s',$value); + } + + // 权限关联 public function authgroup() { @@ -91,6 +98,12 @@ class Admin extends Base return $str; } + // 单位关联模型 + public function adSchool() + { + return $this->belongsTo('\app\system\model\School','school','id'); + } + } diff --git a/application/admin/view/index/create.html b/application/admin/view/index/create.html index 4fc7eaec..51ad007a 100644 --- a/application/admin/view/index/create.html +++ b/application/admin/view/index/create.html @@ -13,6 +13,20 @@ +
+ +
+ + {php} $school = schlist('校级','区级');{/php} + + +
+
{php} diff --git a/application/admin/view/index/edit.html b/application/admin/view/index/edit.html index b7889d26..79ed2cf3 100644 --- a/application/admin/view/index/edit.html +++ b/application/admin/view/index/edit.html @@ -13,6 +13,20 @@
+
+ +
+ + {php} $school = schlist('校级','区级');{/php} + + +
+
{php} diff --git a/application/admin/view/index/index.html b/application/admin/view/index/index.html index b0c1542a..b377ccb6 100644 --- a/application/admin/view/index/index.html +++ b/application/admin/view/index/index.html @@ -36,10 +36,11 @@ + 单位 姓名 + 帐号 性别 出生日期 - 帐号 手机号码 角色 登录次数 @@ -67,10 +68,11 @@ // 定义列参数 var mycolumns = [ { "data": "id" }, + { "data": "ad_school.jiancheng","name":"school","defaultContent": "" }, { "data": "xingming" }, + { "data": "username" }, { "data": "sex" }, { "data": "shengri" }, - { "data": "username" }, { "data": "phone" }, { "data": "groupnames" }, { "data": "denglucishu" }, @@ -131,7 +133,7 @@ }, { "orderable": false, - "targets": [0,-1] + "targets": [0,7,-1] }, ]; diff --git a/application/index/controller/Index.php b/application/index/controller/Index.php index 108d3c7d..b6426174 100644 --- a/application/index/controller/Index.php +++ b/application/index/controller/Index.php @@ -64,7 +64,17 @@ class Index extends Base // 查询用户登录次数 $admin = new \app\admin\model\Admin; $userid = session('userid'); - $list['denglucishu'] = $admin->where('id',$userid)->value('denglucishu'); + $list['denglu'] = $admin->where('id',$userid) + ->field('denglucishu,lastip,lasttime') + ->find(); + $list['yuyan'] = request()->langset(); + $list['server'] = request()->server(); + $list['env'] = request()->env(); + + + + // $list['req'] = request(); + // dump($list); // 获取版本号 $list->version = config('app.chengji.version'); diff --git a/application/index/view/index/welcome.html b/application/index/view/index/welcome.html index f397cd78..3906f252 100644 --- a/application/index/view/index/welcome.html +++ b/application/index/view/index/welcome.html @@ -24,65 +24,9 @@

欢迎使用{$list.title} v{$list.version}!

-

登录次数:{$list.denglucishu}

-

上次登录IP:222.35.131.79.1 上次登录时间:2014-6-14 11:19:55

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
信息统计
统计资讯库图片库产品库用户管理员
总数9290820
今日00000
昨日00000
本周20000
本月20000
+

登录次数:{$list.denglu.denglucishu}

+

上次登录IP:{$list.denglu.lastip} 上次登录时间:{$list.denglu.lasttime}

+

如果需要帮助,请单击左上角“成绩统计”

@@ -91,100 +35,44 @@ - - - - - + - + - + - + - - - - - - - - - - + + - + - + + + + + - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
服务器计算机名http://127.0.0.1/
ThinkPhp版本号ThinkPhp版本号 {$Think.version}
服务器IP地址192.168.1.1{$list.server.SERVER_ADDR}
服务器域名www.h-ui.net{$list.server.HTTP_REFERER}
服务器端口 80{$list.server.SERVER_PORT}
服务器IIS版本 Microsoft-IIS/6.0
本文件所在文件夹 D:\WebSite\HanXiPuTai.com\XinYiCMS.Web\
服务器操作系统 Microsoft Windows NT 5.2.3790 Service Pack 2服务器版本{$list.server.SERVER_SOFTWARE}
系统所在文件夹 C:\WINDOWS\system32{$list.env.ROOT_PATH}
服务器脚本超时时间 30000秒3600秒
缓存超时时间 3天
服务器的语言种类 Chinese (People's Republic of China)
.NET Framework 版本 2.050727.3655
服务器当前时间 2014-6-14 12:06:23{$list.yuyan}
服务器IE版本 6.0000
服务器上次启动到现在已运行 7210分钟
逻辑驱动器 C:\D:\
CPU 总数 4
CPU 类型 x86 Family 6 Model 42 Stepping 1, GenuineIntel
虚拟内存 52480M
当前程序占用内存 3.29M
Asp.net所占内存 51.46M
当前Session数量 8
当前SessionID gznhpwmp34004345jz2q3l45
当前系统用户名 NETWORK SERVICEIE 11.0
diff --git a/database/migrations/20181012140355_member.php b/database/migrations/20181012140355_member.php index 8f5430ad..e50d485c 100644 --- a/database/migrations/20181012140355_member.php +++ b/database/migrations/20181012140355_member.php @@ -38,6 +38,7 @@ class Member extends Migrator ->addColumn('shengri','integer',['limit'=>11,'null'=>true,'comment'=>'出生日期']) ->addColumn('username','string',['limit'=>20,'null'=>false,'comment'=>'用户帐号']) ->addColumn('password','string',['limit'=>37,'null'=>false,'comment'=>'登录密码']) + ->addColumn('school','integer',['limit'=>11,'null'=>false,'comment'=>'所在单位']) ->addColumn('phone','string',['limit'=>11,'null'=>true,'comment'=>'联系方式']) ->addColumn('denglucishu','integer',['limit'=>5,'default'=>0,'null'=>false,'comment'=>'登录次数']) ->addColumn('lastip','string',['limit'=>55,'default'=>'127.0.0.1','null'=>false,'comment'=>'最后一次登录IP']) diff --git a/database/seeds/Admin.php b/database/seeds/Admin.php index 08f45fbe..fef5f5f1 100644 --- a/database/seeds/Admin.php +++ b/database/seeds/Admin.php @@ -20,12 +20,14 @@ class Admin extends Seeder 'id' => 1, 'xingming' => '超级管理员1', 'username' => 'admin', + 'school' => 1, 'password' => '$apr1$RSUodBwI$zOhVq9RQWfQDOW2sbeCDS1', ], [ 'id' => 2, 'xingming' => '超级管理员2', 'username' => 'admin1', + 'school' => 1, 'password' => '$apr1$RSUodBwI$zOhVq9RQWfQDOW2sbeCDS1', ],