From 62377de90f19c9db93f40ab3f4f7196e14b8e3e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Fri, 7 Aug 2020 16:20:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=8F=AD=E7=BA=A7=E5=88=AB?= =?UTF-8?q?=E5=90=8D=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .example.env | 3 -- app/common.php | 15 +++---- app/kaohao/model/Kaohao.php | 25 +++++++++-- app/system/controller/SystemBase.php | 5 ++- app/system/view/system_base/edit.html | 42 +++++++++++++++++++ app/teach/controller/Banji.php | 41 +++++++++++++++++- app/teach/route/teach.php | 1 + app/teach/validate/Banji.php | 6 ++- app/teach/view/banji/index.html | 30 ++++++++++++- .../migrations/20181010035225_system_base.php | 3 ++ database/migrations/20181102004156_banji.php | 1 + database/seeds/SystemBase.php | 3 ++ 12 files changed, 157 insertions(+), 18 deletions(-) diff --git a/.example.env b/.example.env index 87f7e95b..bcaa32f1 100644 --- a/.example.env +++ b/.example.env @@ -19,6 +19,3 @@ default_lang = zh-cn [SESSION] EXPIRE = 1200 - -[SHANGMA] -CLASSMAX = 30 diff --git a/app/common.php b/app/common.php index 1f82e6f2..87fa043e 100644 --- a/app/common.php +++ b/app/common.php @@ -41,14 +41,15 @@ $thisday <= $jiedian ? $str = 1 : $str = 0; $nian = $nian - $str; - $njlist = array(); - $njlist[$nian] = '一年级'; - $njlist[$nian - 1] = '二年级'; - $njlist[$nian - 2] = '三年级'; - $njlist[$nian - 3] = '四年级'; - $njlist[$nian - 4] = '五年级'; - $njlist[$nian - 5] = '六年级'; + // 获取年级最大数 + $sys = new \app\system\model\SystemBase; + $gradeMax = $sys->order('id')->value('grademax'); + $njlist = array(); + for($i = 0; $i < $gradeMax; $i ++) + { + $njlist[$nian - $i] = numToWord($i + 1) . '年级'; + } return $njlist; } diff --git a/app/kaohao/model/Kaohao.php b/app/kaohao/model/Kaohao.php index 38ac7022..dae8db1e 100644 --- a/app/kaohao/model/Kaohao.php +++ b/app/kaohao/model/Kaohao.php @@ -23,7 +23,7 @@ class Kaohao extends BaseModel // 查询成绩 $data = $this->where('kaoshi_id', $src['kaoshi_id']) - ->field('id, school_id, student_id, ruxuenian, paixu, kaoshi_id, nianji') + ->field('id, school_id, student_id, ruxuenian, paixu, kaoshi_id, nianji, banji_id') ->where('banji_id', 'in', $src['banji_id']) ->when(strlen($src['searchval']) > 0, function($query) use($src){ $query->where(function($w) use ($src){ @@ -99,7 +99,7 @@ class Kaohao extends BaseModel public function getBanjiTitleAttr() { $bj = banJiNamelist(); - $title = $this->getAttr('nianji') . $bj[$this->getAttr('paixu')]; + $title = $this->getAttr('nianji') . self::getBanTitleAttr(); return $title; } @@ -107,8 +107,25 @@ class Kaohao extends BaseModel // 获取不带年级的班级名 public function getBanTitleAttr() { - $bj = banJiNamelist(); - $title = $bj[$this->getAttr('paixu')]; + // 获取班级名显示样式 + $sys = new \app\system\model\SystemBase; + $alias = $sys->order('id')->value('classalias'); + if($alias == true) + { + $bj = new \app\teach\model\Banji; + $title = $bj->where('id', $this->getAttr('banji_id'))->value('alias'); + + if($title == '') + { + $bj = banJiNamelist(); + $title = $bj[$this->getAttr('paixu')]; + }else{ + $title = $title . '班'; + } + }else{ + $bj = banJiNamelist(); + $title = $bj[$this->getAttr('paixu')]; + } return $title; } diff --git a/app/system/controller/SystemBase.php b/app/system/controller/SystemBase.php index faa025b8..0d57faf6 100644 --- a/app/system/controller/SystemBase.php +++ b/app/system/controller/SystemBase.php @@ -14,7 +14,7 @@ class SystemBase extends BaseController public function edit() { // 获取用户信息 - $list['data'] = sysbasemod::field('id, keywords, description, thinks, danwei') + $list['data'] = sysbasemod::field('id, keywords, description, thinks, danwei, grademax, classmax, classalias') ->order(['id' => 'desc']) ->find(); @@ -44,6 +44,9 @@ class SystemBase extends BaseController ,'description' ,'thinks' ,'danwei' + ,'grademax' + ,'classmax' + ,'classalias' ], 'put'); $list['id'] = $id; diff --git a/app/system/view/system_base/edit.html b/app/system/view/system_base/edit.html index 48998ee5..ba586dd9 100644 --- a/app/system/view/system_base/edit.html +++ b/app/system/view/system_base/edit.html @@ -22,6 +22,48 @@
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+