diff --git a/app/admin/controller/AdminInfo.php b/app/admin/controller/AdminInfo.php new file mode 100644 index 00000000..39de322b --- /dev/null +++ b/app/admin/controller/AdminInfo.php @@ -0,0 +1,215 @@ +field('id, xingming, sex, shengri, username, teacher_id, school_id, phone, denglucishu, lastip, ip, lasttime, quanpin, shoupin, zhiwu_id, zhicheng_id, biye, zhuanye, xueli_id, worktime, create_time, update_time') + ->with([ + 'adSchool' => function($query){ + $query->field('id, title'); + }, + 'adZhiwu' => function($query){ + $query->field('id, title'); + }, + 'adZhicheng' => function($query){ + $query->field('id, title'); + }, + 'adXueli' => function($query){ + $query->field('id, title'); + }, + ]) + ->find(); + $list['webtitle'] = '帐号信息'; + $list->groupnames = $ad->getGroupnames($id); + + // 模板赋值 + $this->view->assign('list', $list); + + // 渲染模板 + return $this->view->fetch('read'); + } + + + // 修改自己的密码 + public function editPassword() + { + // 设置页面标题 + $list['set'] = array( + 'webtitle' => '修改密码' + ,'butname' => '修改' + ,'formpost' => 'PUT' + ,'url' => '/admin/index/updatepassword/' . session('user_id') + ); + + // 模板赋值 + $this->view->assign('list', $list); + + // 渲染模板 + return $this->view->fetch(); + } + + + // 保存新密码 + public function updatePassword($id) + { + // 获取表单数据 + $list = request()->post(); + + // 验证表单数据 + $validate = new \app\admin\validate\SetPassword; + $result = $validate->check($list); + $msg = $validate->getError(); + + // 如果验证不通过则停止保存 + if(!$result){ + return json(['msg' => $msg, 'val' => 0]);; + } + + // 获取用户名 + $serpassword = AD::where('id', $id)->value('password'); + + // 实例化加密类 + $md5 = new APR1_MD5(); + //验证密码 + $check = $md5->check($list['oldpassword'], $serpassword); + + if(!$check) + { + $data = ['msg' => '旧密码错误', 'val' => 0]; + return json($data); + } + + // 更新密码 + $password = $md5->hash($list['newpassword']); + $data = AD::update(['id' => $id, 'password' => $password]); + + // 根据更新结果设置返回提示信息 + $data ? $data = ['msg' => '修改成功', 'val' => 1] + : $data = ['msg' => '数据处理错误', 'val' => 0]; + + // 返回信息 + return json($data); + } + + + // 读取用户信息 + public function myInfo() + { + $id = session('user_id'); + // 获取管理员信息 + $ad = new AD; + $list = AD::where('id', $id) + ->field('id, xingming, sex, shengri, username, teacher_id, school_id, phone, denglucishu, lastip, ip, lasttime, quanpin, shoupin, zhiwu_id, zhicheng_id, biye, zhuanye, xueli_id, worktime, create_time, update_time') + ->with([ + 'adSchool' => function($query){ + $query->field('id, title'); + }, + 'adZhiwu' => function($query){ + $query->field('id, title'); + }, + 'adZhicheng' => function($query){ + $query->field('id, title'); + }, + 'adXueli' => function($query){ + $query->field('id, title'); + }, + ]) + ->find(); + $list['webtitle'] = '我的信息'; + $list->groupnames = $ad->getGroupnames($id); + + // 模板赋值 + $this->view->assign('list', $list); + + // 渲染模板 + return $this->view->fetch('read'); + } + + + // 查询教师荣誉 + public function srcRy() + { + // 获取参数 + $src = $this->request + ->only([ + 'page' => '1' + ,'limit' => '10' + ,'field' => 'update_time' + ,'order' => 'desc' + ,'teacher_id' => '' + ], 'POST'); + + // 查询数据 + $rongyu = new \app\rongyu\model\JsRongyuInfo; + $data = $rongyu->srcTeacherRongyu($src['teacher_id']) + ->visible([ + 'id' + ,'title' + ,'ryTuce' => [ + 'title' + ,'fzSchool' + ] + ,'jiangxiang_id' + ,'hjshijian' + ,'update_time' + ]); + $data = reSetObject($data, $src); + return json($data); + } + + + // 查询教师课题 + public function srcKt() + { + // 获取参数 + $src = $this->request + ->only([ + 'page' => '1' + ,'limit' => '10' + ,'field' => 'update_time' + ,'order' => 'desc' + ,'teacher_id' => '' + ], 'POST'); + + // 查询数据 + $keti = new \app\keti\model\KetiInfo; + $data = $keti->srcTeacherKeti($src['teacher_id']); + $data = reSetObject($data, $src); + + return json($data); + } + + + // 查询担任班主任情况 + public function srcBzr() + { + // 获取参数 + $src = $this->request + ->only([ + 'page' => '1' + ,'limit' => '10' + ,'field' => 'update_time' + ,'order' => 'desc' + ,'teacher_id' => '' + ], 'POST'); + + // 查询数据 + $bzr = new \app\teach\model\BanZhuRen; + $data = $bzr->srcTeacher($src); + $data = reSetObject($data, $src); + + return json($data); + } +} diff --git a/app/admin/controller/AuthRule.php b/app/admin/controller/AuthRule.php index 34fa835b..0cc09cae 100755 --- a/app/admin/controller/AuthRule.php +++ b/app/admin/controller/AuthRule.php @@ -33,8 +33,7 @@ class AuthRule extends AdminBase // 获取参数 $src = $this->request ->only([ - 'category' => '' - ,'page'=>'1' + 'page'=>'1' ,'limit' => '10' ,'field' => 'id' ,'order' => 'asc' diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index a3b7e331..4b433003 100755 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -123,57 +123,7 @@ class Index extends AdminBase return json($data); } - - // 读取用户信息 - public function read($id) - { - // 获取管理员信息 - $ad = new AD; - $list = AD::where('id', $id) - ->field('id, xingming, sex, shengri, username, teacher_id, school_id, phone, denglucishu, lastip, ip, lasttime, thistime, create_time, update_time') - ->with([ - 'adSchool' => function($query){ - $query->field('id, title'); - } - ]) - ->find(); - $list['webtitle'] = '帐号信息'; - $list->groupnames = $ad->getGroupnames($id); - - // 模板赋值 - $this->view->assign('list', $list); - - // 渲染模板 - return $this->view->fetch(); - } - - - // 读取用户信息 - public function myInfo() - { - $id = session('user_id'); - $ad = new AD; - // 获取管理员信息 - $list = $ad->where('id', $id) - ->field('id, xingming, sex, shengri, username, school_id, phone, denglucishu, lastip, ip, lasttime, thistime, create_time, update_time') - ->with([ - 'adSchool' => function($query){ - $query->field('id, title'); - } - ]) - ->find(); - $list->groupnames = $ad->getGroupnames($id); - $list['webtitle'] = '我的信息'; - - // 模板赋值 - $this->view->assign('list', $list); - - // 渲染模板 - return $this->view->fetch('read'); - } - - - // + // 修改信息 public function edit($id) { // 获取用户信息 @@ -306,68 +256,6 @@ class Index extends AdminBase } - // 修改自己的密码 - public function editPassword() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle' => '修改密码' - ,'butname' => '修改' - ,'formpost' => 'PUT' - ,'url' => '/admin/index/updatepassword/' . session('user_id') - ); - - // 模板赋值 - $this->view->assign('list', $list); - - // 渲染模板 - return $this->view->fetch(); - } - - - // 保存新密码 - public function updatePassword($id) - { - // 获取表单数据 - $list = request()->post(); - - // 验证表单数据 - $validate = new \app\admin\validate\SetPassword; - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg' => $msg, 'val' => 0]);; - } - - // 获取用户名 - $serpassword = AD::where('id', $id)->value('password'); - - // 实例化加密类 - $md5 = new APR1_MD5(); - //验证密码 - $check = $md5->check($list['oldpassword'], $serpassword); - - if(!$check) - { - $data = ['msg' => '旧密码错误', 'val' => 0]; - return json($data); - } - - // 更新密码 - $password = $md5->hash($list['newpassword']); - $data = AD::update(['id' => $id, 'password' => $password]); - - // 根据更新结果设置返回提示信息 - $data ? $data = ['msg' => '修改成功', 'val' => 1] - : $data = ['msg' => '数据处理错误', 'val' => 0]; - - // 返回信息 - return json($data); - } - - // 查询管理员 public function adminList() { @@ -465,59 +353,4 @@ class Index extends AdminBase return json($data); } - - - // 查询教师荣誉 - public function srcRy() - { - // 获取参数 - $src = $this->request - ->only([ - 'page' => '1' - ,'limit' => '10' - ,'field' => 'update_time' - ,'order' => 'desc' - ,'admin_id' => '' - ], 'POST'); - - // 查询数据 - $rongyu = new \app\rongyu\model\JsRongyuInfo; - $data = $rongyu->srcTeacherRongyu($src['admin_id']) - ->visible([ - 'id' - ,'title' - ,'ryTuce' => [ - 'title' - ,'fzSchool' - ] - ,'jiangxiang_id' - ,'hjshijian' - ,'update_time' - ]); - $data = reSetObject($data, $src); - return json($data); - } - - - // 查询教师课题 - public function srcKt() - { - // 获取参数 - $src = $this->request - ->only([ - 'page' => '1' - ,'limit' => '10' - ,'field' => 'update_time' - ,'order' => 'desc' - ,'admin_id' => '' - ], 'POST'); - - // 查询数据 - $keti = new \app\keti\model\KetiInfo; - $data = $keti->srcTeacherKeti($src['admin_id']); - $data = reSetObject($data, $src); - - return json($data); - } - } diff --git a/app/admin/model/Admin.php b/app/admin/model/Admin.php index df8545bc..2e8f6781 100755 --- a/app/admin/model/Admin.php +++ b/app/admin/model/Admin.php @@ -21,7 +21,7 @@ class Admin extends BaseModel ->where('id', '>', 2) ->where('id', '<>', session('userid')) ->when(strlen($src['searchval']) > 0, function($query) use($src){ - $query->where('xingming|username', 'like', '%' . $src['searchval'] . '%'); + $query->where('xingming|username|quanpin|shoupin', 'like', '%' . $src['searchval'] . '%'); }) ->with([ 'adSchool' => function($query){ @@ -310,6 +310,70 @@ class Admin extends BaseModel } + // 退休获取器 + public function getTuixiuAttr($value) + { + $sex = array('0' => '退休', '1' => '在职'); + $str = ''; + if(isset($sex[$value])) + { + $str = $sex[$value]; + }else{ + $str = '未知'; + } + return $str; + } + + + // 年龄获取器 + public function getAgeAttr() + { + return \app\facade\Tools::fBirth($this->getdata('shengri'), 2); + } + + + // 工龄获取器 + public function getGonglingAttr() + { + return \app\facade\Tools::fBirth($this->getdata('worktime'), 2); + } + + + // 职务关联模型 + public function adZhiwu() + { + return $this->belongsTo('\app\system\model\Category', 'zhiwu_id', 'id'); + } + + + // 职称关联模型 + public function adZhicheng() + { + return $this->belongsTo('\app\system\model\Category', 'zhicheng_id', 'id'); + } + + + // 学历关联模型 + public function adXueli() + { + return $this->belongsTo('\app\system\model\Category', 'xueli_id', 'id'); + } + + + // 单位关联模型 + public function adDanwei() + { + return $this->belongsTo('\app\system\model\School', 'danwei_id', 'id'); + } + + + // 学科关联模型 + public function adSubject() + { + return $this->belongsTo('\app\teach\model\Subject', 'subject_id', 'id'); + } + + // 分割表格上传数据 private function cutStr($value) { @@ -323,8 +387,6 @@ class Admin extends BaseModel return $str; } - - static function newId($oldId) { $id = self::withTrashed()->where('teacher_id', $oldId)->value('id'); diff --git a/app/admin/model/AuthRule.php b/app/admin/model/AuthRule.php index eac240be..bfbffdda 100755 --- a/app/admin/model/AuthRule.php +++ b/app/admin/model/AuthRule.php @@ -29,7 +29,6 @@ class AuthRule extends BaseModel $src = [ 'searchval' => '' ,'status' => '' - ,'category' => '' ]; $src = array_cover($srcfrom, $src); @@ -38,9 +37,6 @@ class AuthRule extends BaseModel ->when(strlen($src['searchval']) > 0, function($query) use($src){ $query->where('title|name', 'like', '%' . $src['searchval'] . '%'); }) - ->when(strlen($src['category']) > 0, function($query) use($src){ - $query->where($src['category'], 1); - }) ->when(strlen($src['status']) > 0, function($query) use($src){ $query->where('status', $src['status']); }) diff --git a/app/admin/route/admin.php b/app/admin/route/admin.php index efcd9399..813c662e 100755 --- a/app/admin/route/admin.php +++ b/app/admin/route/admin.php @@ -21,17 +21,12 @@ Route::group('index', function () { Route::rule('update/', 'Index/update', 'put'); # 更新信息 Route::rule('delete/', 'Index/delete', 'delete'); # 删除信息 Route::rule('status', 'Index/setStatus', 'post'); # 删除信息 - Route::rule('resetpassword/', 'Index/resetPassword', 'post'); # 重置密码 - Route::rule('editpassword', 'Index/editPassword', 'get'); # 修改密码 - Route::rule('updatepassword/', 'Index/updatePassword', 'put'); # 更新密码 - Route::rule('myinfo', 'Index/myInfo', 'get'); # 用户信息 Route::rule('adminlist', 'Index/adminList', 'post'); # 用户信息 Route::rule('downloadxls', 'Index/downloadxls', 'get'); # 用户信息 Route::rule('createall','Index/createAll','get'); # 批量导入 Route::rule('saveall','Index/saveAll','post'); # 批量保存 Route::rule('srcteacher','Index/srcAdmin','post'); # 查询教师 - Route::rule('srcry','Index/srcRy','post'); # 查询荣誉 - Route::rule('srckt','Index/srcKt','post'); # 查询课题 + Route::rule('resetpassword/', 'Index/resetPassword', 'post'); # 重置密码 }); @@ -85,3 +80,15 @@ Route::group('tongbu', function () { Route::rule('ktcy','Tongbu/ktcy','post'); Route::rule('tjbj','Tongbu/tjbj','post'); }); + + +// 管理员信息 +Route::group('info', function () { + Route::rule('read/','AdminInfo/readAdmin','get'); + Route::rule('editpassword', 'AdminInfo/editPassword', 'get'); # 修改密码 + Route::rule('updatepassword/', 'AdminInfo/updatePassword', 'put'); # 更新密码 + Route::rule('myinfo', 'AdminInfo/myInfo', 'get'); # 用户信息 + Route::rule('srcry','AdminInfo/srcRy','post'); # 查询荣誉 + Route::rule('srckt','AdminInfo/srcKt','post'); # 查询课题 + Route::rule('srcbzr','AdminInfo/srcBzr','post'); # 查询课题 +}); diff --git a/app/admin/view/admin_info/read.html b/app/admin/view/admin_info/read.html new file mode 100644 index 00000000..98631f35 --- /dev/null +++ b/app/admin/view/admin_info/read.html @@ -0,0 +1,306 @@ + + + + + {php}echo session('webtitle'){/php} + + + + {load href="__XADMIN__/css/font.css" /} + {load href="__XADMIN__/css/xadmin.css" /} + {load href="__XADMIN__/js/jquery.min.js" /} + {load href="__XADMIN__/lib/layui/layui.js" /} + {load href="__XADMIN__/js/xadmin.js" /} + {load href="__XADMIN__/js/cookie.js" /} + {load href="__XADMIN__/js/md5.min.js" /} + {$list.webtitle} + + +
+
+ 个人信息 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
帐号{$list.username}登录次数{$list.denglucishu}
姓名{$list.xingming}        {$list.quanpin}        {$list.shoupin}性别{$list.sex}
用户组 + {$list.groupnames} + 最后一次登录{$list.lastip}         + {$list.lasttime}
出生日期{$list.shengri}        {$list.age}周岁参加工作时间{$list.worktime}        {$list.gongling}年工龄
在职状态{$list.tuixiu}职务{$list.adZhiwu.title}
职称{$list.adZhicheng.title}工作单位{$list.adSchool.title}
毕业院校{$list.biye}专业{$list.zhuanye}
学历{$list.adXueli.title}联系电话{$list.phone}
+
+
+
+ 获奖情况 +
+
+
+
+
+ 参与课题情况 +
+
+
+
+
+ 担任班主任情况 +
+
+
+
+ + + diff --git a/app/admin/view/auth_rule/index.html b/app/admin/view/auth_rule/index.html index 6a06e516..d24ca09f 100755 --- a/app/admin/view/auth_rule/index.html +++ b/app/admin/view/auth_rule/index.html @@ -19,15 +19,6 @@
-
- -
- - - -
-
- {/block} {block name="table"}
diff --git a/app/admin/view/index/index.html b/app/admin/view/index/index.html index 1f743d31..b83a78a0 100755 --- a/app/admin/view/index/index.html +++ b/app/admin/view/index/index.html @@ -113,7 +113,7 @@ var tr = obj.tr; //获得当前行 tr 的DOM对象 switch(layEvent){ case 'detail':// 查看 - cjgl.add(obj.data.xingming+'信息','/admin/index/read/'+obj.data.id,'','',true); + cjgl.add(obj.data.xingming+'信息','/admin/info/read/'+obj.data.id,'','',true); break; case 'del':// 删除 cjgl.del(obj,"/admin/index/delete"); diff --git a/app/admin/view/index/read.html b/app/admin/view/index/read.html deleted file mode 100755 index e864ddc3..00000000 --- a/app/admin/view/index/read.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - {php}echo session('webtitle'){/php} - - - - {load href="__XADMIN__/css/font.css" /} - {load href="__XADMIN__/css/xadmin.css" /} - {load href="__XADMIN__/js/jquery.min.js" /} - {load href="__XADMIN__/lib/layui/layui.js" /} - {load href="__XADMIN__/js/xadmin.js" /} - {load href="__XADMIN__/js/cookie.js" /} - {load href="__XADMIN__/js/md5.min.js" /} - {$list.webtitle} - - -
- -
- 个人信息 -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
帐号{$list.username}
姓名{$list.xingming}
性别{$list.sex}
出生日期{$list.shengri}
所在单位{$list.ad_school.title}
拥有角色 - {$list.groupnames} -
联系电话{$list.phone}
登录次数{$list.denglucishu}
上次登录{$list.lastip}         - {$list.lasttime}
本次登录{$list.ip}         - {$list.thistime}
注册时间{$list.create_time}
更新时间{$list.update_time}
-
-
- - diff --git a/app/index/view/index/index.html b/app/index/view/index/index.html index 0ff746d3..3c85bbbf 100755 --- a/app/index/view/index/index.html +++ b/app/index/view/index/index.html @@ -69,7 +69,7 @@
- + 个人信息