From 82458a93099f03ac3c6aa9fb81e9afba0a4e3efd Mon Sep 17 00:00:00 2001 From: win10 Date: Tue, 14 Jul 2020 16:52:57 +0800 Subject: [PATCH] 0 --- app/admin/model/Admin.php | 9 +++++---- app/admin/model/AuthGroupAccess.php | 3 ++- app/common.php | 14 ++++++++++++-- app/system/controller/School.php | 1 - app/system/model/School.php | 23 ++++++++++++++++++++++- app/system/view/category/create.html | 2 +- app/system/view/category/index.html | 2 +- app/system/view/school/create.html | 6 +++--- app/system/view/school/index.html | 4 ++-- app/teach/model/Banji.php | 16 ++++++++-------- app/teach/view/banji/index.html | 2 +- app/teach/view/subject/create.html | 2 +- app/teacher/model/Teacher.php | 4 ++-- app/teacher/view/index/create.html | 8 ++++---- app/teacher/view/index/create_all.html | 2 +- app/teacher/view/index/del_list.html | 2 +- app/teacher/view/index/index.html | 8 ++++---- 17 files changed, 70 insertions(+), 38 deletions(-) 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 @@
- {php} $category = getCategory(0);{/php} + {php} $category = categoryChildren(0);{/php} - {php} $pid = getCategory(0);{/php} + {php} $pid = categoryChildren(0);{/php} {volist name="pid" id="vo"} {/volist} diff --git a/app/system/view/school/create.html b/app/system/view/school/create.html index ec1c5531..ef675436 100644 --- a/app/system/view/school/create.html +++ b/app/system/view/school/create.html @@ -32,7 +32,7 @@
- {php} $category = getCategory(101);{/php} + {php} $category = categoryChildren(101);{/php} {volist name="category" id="vo"} @@ -72,7 +72,7 @@ *学段
- {php} $category = getCategory(103);{/php} + {php} $category = categoryChildren(103);{/php} - {php} $category = getCategory(102);{/php} + {php} $category = categoryChildren(102);{/php} {volist name="category" id="vo"} {/volist} @@ -33,7 +33,7 @@
- {php} $category = getCategory(101);{/php} + {php} $category = categoryChildren(101);{/php} {volist name="category" id="vo"} {/volist} diff --git a/app/teach/model/Banji.php b/app/teach/model/Banji.php index fa48da24..4b2b9195 100644 --- a/app/teach/model/Banji.php +++ b/app/teach/model/Banji.php @@ -101,7 +101,7 @@ class Banji extends BaseModel public function getNumTitleAttr() { // 获取基础信息 - $njname = nianJiNameList(); # 年级名对应表 + $njname = $this->gradeName(); # 年级名对应表 $nj = $this->getAttr('ruxuenian'); $bj = $this->getAttr('paixu'); $numnj = array_flip(array_keys($njname)); @@ -121,8 +121,8 @@ class Banji extends BaseModel public function getBanjiTitleAttr() { //获取班级、年级列表 - $njlist = nianJiNameList(); - $bjlist = banJiNamelist(); + $njlist = $this->gradeName(); + $bjlist = $this->className(); $nj = $this->getAttr('ruxuenian'); $bj = $this->getAttr('paixu'); @@ -142,7 +142,7 @@ class Banji extends BaseModel // 班名获取器 public function getBanTitleAttr() { - $bjname = banjinamelist(); + $bjname = $this->className(); $bj = $this->getAttr('paixu'); // 获取班级名 @@ -184,8 +184,8 @@ class Banji extends BaseModel ->find(); //获取班级、年级列表 - $njlist = nianJiNameList($jdshijian); - $bjlist = banJiNamelist(); + $njlist = $this->gradeName($jdshijian); + $bjlist = $this->className(); if(array_key_exists($bjinfo->ruxuenian, $njlist)) { @@ -216,8 +216,8 @@ class Banji extends BaseModel return false; } // 获取年级、班级列表 - $njlist = nianJiNameList(); - $bjlist = banJiNameList(); + $njlist = $this->gradeName(); + $bjlist = $this->className(); $nj = substr($str, 0, 9); $bj = substr($str, 9, strlen($str) - 9); diff --git a/app/teach/view/banji/index.html b/app/teach/view/banji/index.html index ba8b0614..061839cc 100644 --- a/app/teach/view/banji/index.html +++ b/app/teach/view/banji/index.html @@ -15,7 +15,7 @@
{php} - $schoollist = schoolList('校级','校级'); + $schoollist = schoolXueduan('小学','初中'); {/php} {volist name="schoollist" id="vo"} diff --git a/app/teach/view/subject/create.html b/app/teach/view/subject/create.html index 8bf46525..9613a2a1 100644 --- a/app/teach/view/subject/create.html +++ b/app/teach/view/subject/create.html @@ -76,7 +76,7 @@
+ autocomplete="off" class="layui-input" value="{$list.data.paixu|default=999}" placeholder="数字1-999">
diff --git a/app/teacher/model/Teacher.php b/app/teacher/model/Teacher.php index 800e69a1..72589924 100644 --- a/app/teacher/model/Teacher.php +++ b/app/teacher/model/Teacher.php @@ -316,14 +316,14 @@ class Teacher extends BaseModel // 年龄获取器 public function getAgeAttr() { - return getAgeByBirth($this->getdata('shengri'), 2); + return $this->fBirth($this->getdata('shengri'), 2); } // 工龄获取器 public function getGonglingAttr() { - return getAgeByBirth($this->getdata('worktime'), 2); + return $this->fBirth($this->getdata('worktime'), 2); } diff --git a/app/teacher/view/index/create.html b/app/teacher/view/index/create.html index 152fb31a..47018e56 100644 --- a/app/teacher/view/index/create.html +++ b/app/teacher/view/index/create.html @@ -59,7 +59,7 @@
- {php} $schoollist = schoolList('校级', '市级', 'asc');{/php} + {php} $schoollist = danweiJibie('校级', '市级', 'asc');{/php} {volist name="category" id="vo"} @@ -101,7 +101,7 @@ 职称
- {php} $category = getCategory(106);{/php} + {php} $category = categoryChildren(106);{/php} {volist name="category" id="vo"} diff --git a/app/teacher/view/index/create_all.html b/app/teacher/view/index/create_all.html index af5f6565..2b446ce7 100644 --- a/app/teacher/view/index/create_all.html +++ b/app/teacher/view/index/create_all.html @@ -19,7 +19,7 @@
- {php} $schoollist = schoolList('校级', '区级', 'asc');{/php} + {php} $schoollist = danweiJibie('校级', '区级', 'asc');{/php} - {php} $schoollist = schoolList('校级', '区级');{/php} + {php} $schoollist = danweiJibie('校级', '区级');{/php} {volist name="schoollist" id="vo"} {/volist} diff --git a/app/teacher/view/index/index.html b/app/teacher/view/index/index.html index dda0ed95..3d218fc3 100644 --- a/app/teacher/view/index/index.html +++ b/app/teacher/view/index/index.html @@ -24,7 +24,7 @@
- {php} $schoollist = schoolList('校级', '区级');{/php} + {php} $schoollist = danweiJibie('校级', '区级');{/php} {volist name="schoollist" id="vo"} {/volist} @@ -34,7 +34,7 @@
- {php} $category = getCategory(107);{/php} + {php} $category = categoryChildren(107);{/php} {volist name="category" id="vo"} {/volist} @@ -44,7 +44,7 @@
- {php} $category = getCategory(105);{/php} + {php} $category = categoryChildren(105);{/php} {volist name="category" id="vo"} {/volist} @@ -54,7 +54,7 @@
- {php} $category = getCategory(106);{/php} + {php} $category = categoryChildren(106);{/php} {volist name="category" id="vo"} {/volist}