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 @@