diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php index 01ebd1d6..58fc3d41 100644 --- a/application/admin/controller/Index.php +++ b/application/admin/controller/Index.php @@ -133,18 +133,17 @@ class Index extends Base public function read($id) { // 获取管理员信息 + $ad = new AD; $list = AD::where('id',$id) ->field('id,xingming,sex,shengri,username,school,phone,denglucishu,lastip,ip,lasttime,thistime,create_time,update_time') ->with([ 'adSchool'=>function($query){ $query->field('id,title'); } - ,'glGroup'=>function($query){ - $query->where('status',1)->field('title,rules,miaoshu'); - } ]) ->find(); $list['webtitle'] = '帐号信息'; + $list->groupnames = $ad->getGroupnames($id); // 模板赋值 $this->assign('list',$list); @@ -158,18 +157,19 @@ class Index extends Base public function myinfo() { $id = session('userid'); + $ad = new AD; // 获取管理员信息 - $list = AD::where('id',$id) + $list = $ad->where('id',$id) ->field('id,xingming,sex,shengri,username,school,phone,denglucishu,lastip,ip,lasttime,thistime,create_time,update_time') ->with([ 'adSchool'=>function($query){ $query->field('id,title'); } - ,'glGroup'=>function($query){ - $query->where('status',1)->field('title,rules,miaoshu'); - } ]) ->find(); + $list->groupnames = $ad->getGroupnames($id); + + $list['webtitle'] = '我的信息'; // 模板赋值 diff --git a/application/admin/model/Admin.php b/application/admin/model/Admin.php index 9afdf521..2d89a907 100644 --- a/application/admin/model/Admin.php +++ b/application/admin/model/Admin.php @@ -104,44 +104,36 @@ class Admin extends Base } - // // 获取角色id表 - // public function getGroupidsAttr() - // { - // // 获取当前当前管理员信息 - // $admin = $this->get($this->getAttr('id')); - // // 获取角色id - // $list = $admin->authgroup()->column('group_id'); + // 获取角色名称 + public function getGroupnames($userid) + { + // 如果用户ID为1或2,则为超级管理员 + if($userid == 1 || $userid == 2) + { + return '超级管理员'; + } - // $str = ''; - // // 将角色id转换成数组 - // foreach ($list as $key => $value) { - // $key == 0 ? $str =$value : $str = $str.','.$value; - // } + // 查询用户拥有的权限 + $admininfo = $this->where('id',$userid) + ->field('id') + ->with([ + 'glGroup'=>function($query){ + $query->where('status',1)->field('title'); + } + ]) + ->find(); + $groupname = ''; + foreach ($admininfo->gl_group as $key => $value) { + if($key == 0){ + $groupname = $value->title; + }else{ + $groupname = $groupname.'、'.$value->title; + } + } - // // 返回值 - // return $str; - // } - - // // 获取角色名称 - // public function getGroupnamesAttr() - // { - // // 获取角色id - // $group = $this->get($this->getAttr('id'))->append(['groupids']); - - // $str = ''; - // // 查询角色名称 - // $grouplist= db('AuthGroup')->where('id','in',$group->groupids)->column('title'); - // // 重组角色名 - // foreach ($grouplist as $key => $value) { - // if($key == 0){ - // $str = $value; - // }else{ - // $str = $str.'、'.$value; - // } - // } - // // 返回角色名 - // return $str; - // } + // 返回角色名 + return $groupname; + } // 单位关联模型 public function adSchool() diff --git a/application/admin/view/index/index.html b/application/admin/view/index/index.html index cf574083..556b07e4 100644 --- a/application/admin/view/index/index.html +++ b/application/admin/view/index/index.html @@ -71,7 +71,7 @@ }}, {field: 'phone', title: '联系电话', minWidth:130, sort: true}, {field: 'denglucishu', title: '登录次数', minWidth:100, sort: true}, - {field: 'thistime', title: '最后登录时间', minWidth:130, sort: true}, + {field: 'thistime', title: '最后登录时间', minWidth:180, sort: true}, {field: 'ip', title: '最后登录地址', minWidth:150, sort: true}, {field: 'status', title: '状态',templet:'#status', sort: true}, {field: 'id', title: '操作',toolbar: '#barDemo',minWidth:140} diff --git a/application/admin/view/index/read.html b/application/admin/view/index/read.html index df35408a..1a0e95c5 100644 --- a/application/admin/view/index/read.html +++ b/application/admin/view/index/read.html @@ -42,11 +42,7 @@ 拥有角色 - {volist name="list.gl_group" id="vo"} - {gt name="key" value="0"}、{/gt} - {$vo.title} - {/volist} - + {$list.groupnames} 联系电话 diff --git a/application/chengji/model/Chengji.php b/application/chengji/model/Chengji.php index a2797a69..1dc31e62 100644 --- a/application/chengji/model/Chengji.php +++ b/application/chengji/model/Chengji.php @@ -15,94 +15,6 @@ class Chengji extends Base return $this->belongsTo('\app\teach\model\Subject'); } - // /** - // * 根据考试ID和班级获取学生各学科成绩、平均分、总分 - // * - // * @access public - // * @param mixed $kaoshi 当前考试ID - // * @param array $banji 学生所在班级 - // * @return array 返回类型 - // */ - // public function srcChengji($kaoshi=0,$banji=array()) - // { - // $kh = new \app\kaoshi\model\Kaohao; - // $khlist = $kh->where('kaoshi',$kaoshi) - // ->field('id,school,student,nianji,banji') - // ->when(count($banji)>0,function($query) use($banji){ - // $query->where('banji','in',$banji); - // }) - // ->with([ - // 'ksChengji'=>function($query){ - // $query->field('kaohao_id,subject_id,defen'); - // } - // ,'cjBanji'=>function($query){ - // $query->field('id,paixu,ruxuenian') - // ->append(['numTitle','banjiTitle']); - // } - // ,'cjSchool'=>function($query){ - // $query->field('id,jiancheng'); - // } - // ,'cjStudent'=>function($query){ - // $query->field('id,xingming,sex'); - // } - // ]) - // ->select(); - - - // // 获取参考学科 - // $ks = new \app\kaoshi\model\Kaoshi; - // $ksinfo = $ks->where('id',$kaoshi) - // ->with([ - // 'ksSubject'=>function($query){ - // $query->field('kaoshiid,subjectid,lieming'); - // } - // ]) - // ->find(); - // $xk = array(); - // foreach ($ksinfo->ks_subject as $key => $value) { - // $xk[$value->subjectid] = $value->lieming; - // } - - - // // 整理数据 - // $data = array(); - // foreach ($khlist as $key => $value) { - // $data[$key]['id'] = $value->id; - // $data[$key]['school'] = $value->cj_school->jiancheng; - // if(isset($value->cj_student)){ - // $data[$key]['student'] = $value->cj_student->xingming; - // $data[$key]['sex'] = $value->cj_student->sex; - // }else{ - // $stu = new \app\renshi\model\Student; - // $stuname = $stu::withTrashed()->where('id',$value->student)->field('id,xingming,sex')->find(); - // $data[$key]['student'] = $stuname->xingming; - // $data[$key]['sex'] = $stuname->sex; - // } - // $data[$key]['nianji'] = $value->nianji; - // $data[$key]['banji'] = $value->cj_banji->banji_title; - // $dfsum = 0; - // $sbjcnt = 0; - // foreach ($value->ks_chengji as $k => $val) { - // $data[$key][$xk[$val->subject_id]] = $val->defen*1; - // $dfsum = $dfsum + $val->defen*1; - // $sbjcnt ++; - // } - // $data[$key]['sum'] = $dfsum; - // if($sbjcnt>0){ - // $data[$key]['avg'] = round($dfsum/$sbjcnt,1); - // }else{ - // $data[$key]['avg'] = 0; - // } - // } - - // // // 按条件排序 - // // if(count($data)>0){ - // // $data = arraySequence($data,$src['field'],$src['type']); //排序 - // // } - // return $data; - // } - - // 学科关联 public function subjectName() { diff --git a/application/common/view/list.html b/application/common/view/list.html index 5cf8cc4e..1567b327 100644 --- a/application/common/view/list.html +++ b/application/common/view/list.html @@ -69,7 +69,8 @@ defaultToolbar:'', where:{}, limits:[10,25,50,75,100], - limit:10 + limit:10, + height:450, }; {block name="myjs"}{/block} diff --git a/application/http/middleware/YanZheng.php b/application/http/middleware/YanZheng.php index 65576092..095a0460 100644 --- a/application/http/middleware/YanZheng.php +++ b/application/http/middleware/YanZheng.php @@ -78,7 +78,7 @@ class YanZheng extends Controller // 验证方法 if( !$auth->check($url, session('userid')) && $except == false ){// 第一个参数是规则名称,第二个参数是用户UID - $this->error('哎哟~ 权限不足'); + $this->error('哎哟~ 因为权限不足'); } return $next($request); diff --git a/application/index/controller/Index.php b/application/index/controller/Index.php index 2822afa1..7e2bb7d9 100644 --- a/application/index/controller/Index.php +++ b/application/index/controller/Index.php @@ -105,25 +105,10 @@ class Index extends Base // 查询用户登信息 $list['username'] = session('username'); - // 查询用户组 + + // 查询用户所 $admin = new \app\admin\model\Admin; - $admininfo = $admin->where('username',$list['username']) - ->field('id') - ->with([ - 'glGroup'=>function($query){ - $query->where('status',1)->field('title,rules,miaoshu'); - } - ]) - ->find(); - $list['group'] = ''; - foreach ($admininfo->gl_group as $key => $value) { - if($key==0) - { - $list['group'] = $value->title; - }else{ - $list['group'] = $list['group'].'、'.$value->title; - } - } + $list['group'] = $admin->getGroupnames(session('userid')); $list['server'] = request()->server(); // 获取版本号 diff --git a/public/error/error.tpl b/public/error/error.tpl index de93461b..4ecac4fa 100644 --- a/public/error/error.tpl +++ b/public/error/error.tpl @@ -1,77 +1,27 @@ - - - - - - - - - -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui/css/H-ui.min.css" /} -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/css/H-ui.admin.css" /} -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/Hui-iconfont/1.0.8/iconfont.css" /} - -系统提示 - + + + + + 后台登录-X-admin2.1 + + + + + + + + + 系统提示 -
-

- 系统提示 -

-

- -
-

-
-{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery/1.9.1/jquery.min.js"} -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui/js/H-ui.min.js"} -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/js/H-ui.admin.js"} - - - - - + +
+
+
+

+

,啥都看不到了…

+
+
+
+
+ \ No newline at end of file