diff --git a/app/admin/model/Admin.php b/app/admin/model/Admin.php index 7131370d..2829c572 100644 --- a/app/admin/model/Admin.php +++ b/app/admin/model/Admin.php @@ -27,9 +27,10 @@ class Admin extends BaseModel 'adSchool' => function($query){ $query->field('id, jiancheng'); } - ,'glGroup' => function($query){ - $query->where('status', 1)->field('title, rules, miaoshu'); - } + ,'glGroup' + // ,'glGroup' => function($query){ + // $query->where('status', 1)->field('title, rules, miaoshu'); + // } ]) ->hidden([ 'password' @@ -67,7 +68,7 @@ class Admin extends BaseModel public function glGroup() { - return $this->belongsToMany('AuthGroup', 'AuthGroupAccess', 'group_id', 'uid'); + return $this->belongsToMany('AuthGroup', 'AuthGroupAccess', 'uid', 'group_id'); } diff --git a/app/admin/model/AuthGroupAccess.php b/app/admin/model/AuthGroupAccess.php index 38170c5a..b715e781 100644 --- a/app/admin/model/AuthGroupAccess.php +++ b/app/admin/model/AuthGroupAccess.php @@ -4,8 +4,9 @@ namespace app\admin\model; // 引用用户数据模型 use app\BaseModel; +use think\model\Pivot; -class AuthGroupAccess extends BaseModel +class AuthGroupAccess extends Pivot { // 根据角色ID查询用户 public function search($srcfrom) diff --git a/app/common.php b/app/common.php index f6a3f864..dbc06722 100644 --- a/app/common.php +++ b/app/common.php @@ -12,7 +12,7 @@ // 应用公共文件 // 获取类别列表 - function getCategory($p_id = 0) + function categoryChildren($p_id = 0) { // 查询类别 $category = new \app\system\model\Category; @@ -63,7 +63,7 @@ // 单位列表 - function schoolList($low = '班级', $high = '其它级', $order = 'asc') + function danweiJibie($low = '班级', $high = '其它级', $order = 'asc') { // 实例化单位模型 $sch = new \app\system\model\School; @@ -72,6 +72,16 @@ } + // 单位列表 + function schoolXueduan($low = '幼儿园', $high = '其它学段', $order = 'asc') + { + // 实例化单位模型 + $sch = new \app\system\model\School; + $data = $sch->srcSchool($low, $high, $order); + return $data; + } + + // 可以组织考试的单位列表 function kaoshiSchoolList() { diff --git a/app/system/controller/School.php b/app/system/controller/School.php index 0f6c049d..2c641e72 100644 --- a/app/system/controller/School.php +++ b/app/system/controller/School.php @@ -43,7 +43,6 @@ class School extends AdminBase // 实例化 $sch = new sch; - $data = $sch->search($src); // 查询要显示的数据 diff --git a/app/system/model/School.php b/app/system/model/School.php index 355fda26..1765bd15 100644 --- a/app/system/model/School.php +++ b/app/system/model/School.php @@ -108,7 +108,6 @@ class School extends BaseModel { // 实例化类别数据模型 $cat = new \app\system\model\Category; - // 获取获取级别列表 $catlist = $cat->where('p_id', 102) ->where('status', 1) ->column('id', 'title'); @@ -122,4 +121,26 @@ class School extends BaseModel return $schlist; } + + + // 根据学段查学校 + public function srcSchool($low = '幼儿园', $high = '其它学段', $order = 'asc') + { + // 实例化类别数据模型 + $cat = new \app\system\model\Category; + $catlist = $cat->where('p_id', 103) + ->where('status', 1) + ->column('id', 'title'); + + // 查询学校 + $schlist = $this->where('xueduan_id', 'between', [$catlist[$low], $catlist[$high]]) + ->where('status', 1) + ->where('jibie_id', 10203) + ->order(['xueduan_id' => $order, 'paixu']) + ->field('id, title, jiancheng') + ->select(); + + return $schlist; + } + } diff --git a/app/system/view/category/create.html b/app/system/view/category/create.html index 4b87108d..5c71d678 100644 --- a/app/system/view/category/create.html +++ b/app/system/view/category/create.html @@ -14,7 +14,7 @@