diff --git a/app/BaseController.php b/app/BaseController.php index 1960ea9b..6fb354c8 100644 --- a/app/BaseController.php +++ b/app/BaseController.php @@ -8,6 +8,7 @@ use think\exception\ValidateException; use think\Validate; use app\middleware\UserLogin; use app\middleware\Auth; +use app\middleware\Online; /** @@ -15,7 +16,6 @@ use app\middleware\Auth; */ abstract class BaseController { - /** * Request实例 * @var \think\Request @@ -40,7 +40,9 @@ abstract class BaseController * @var array */ protected $middleware = [ - 'login','auth' + 'auth' + ,'login' + ]; /** diff --git a/app/StudentSearchBase.php b/app/StudentSearchBase.php new file mode 100644 index 00000000..052cdfc2 --- /dev/null +++ b/app/StudentSearchBase.php @@ -0,0 +1,19 @@ +where('id', $id) @@ -314,7 +314,7 @@ class Index extends BaseController 'webtitle' => '修改密码' ,'butname' => '修改' ,'formpost' => 'PUT' - ,'url' => '/admin/index/updatepassword/' . session('userid') + ,'url' => '/admin/index/updatepassword/' . session('admin.userid') ); // 模板赋值 diff --git a/app/chengji/common.php b/app/chengji/common.php index e388c51c..3b8a600b 100644 --- a/app/chengji/common.php +++ b/app/chengji/common.php @@ -30,11 +30,11 @@ function manfenvalidate($defen, $manfen) return $data; } - if ( ($defen*10)%5 != 0 ) { - $data['val'] = 0; - $data['msg'] = '得分必须只能是x.5'; - return $data; - } + // if ( ($defen*10)%5 != 0 ) { + // $data['val'] = 0; + // $data['msg'] = '得分必须只能是x.5'; + // return $data; + // } return $data; } diff --git a/app/chengji/controller/Bjtongji.php b/app/chengji/controller/Bjtongji.php index bba785d9..03840b24 100644 --- a/app/chengji/controller/Bjtongji.php +++ b/app/chengji/controller/Bjtongji.php @@ -420,6 +420,7 @@ class Bjtongji extends BaseController ,'school_id' => array() ,'banji_id' => array() ,'subject_id' => '' + ,'cishu' => 20 ], 'POST'); if (count($src['banji_id']) == 0) { diff --git a/app/chengji/controller/Index.php b/app/chengji/controller/Index.php index 0062bb81..04606b45 100644 --- a/app/chengji/controller/Index.php +++ b/app/chengji/controller/Index.php @@ -17,14 +17,15 @@ class Index extends BaseController // 获取参加考试的年级和学科 $ksset = new \app\kaoshi\model\KaoshiSet; $list['set']['nianji'] = $ksset->srcNianji($kaoshi_id); - $list['set']['subject_id'] = $ksset->srcSubject($kaoshi_id); + $src['kaohao_id'] = $kaoshi_id; + $list['set']['subject_id'] = $ksset->srcSubject($src); if (count($list['set']['nianji']) > 0) { $src['ruxuenian']=$list['set']['nianji'][0]; } else { $src['ruxuenian']=array(); } $src['kaoshi_id'] = $kaoshi_id; - $khSrc = new \app\kaohao\model\Search; + $khSrc = new \app\kaohao\model\SearchMore; $list['set']['school_id'] = $khSrc->cySchool($src); $list['kaoshi_id'] = $kaoshi_id; $list['dataurl'] = '/chengji/index/data'; @@ -54,7 +55,7 @@ class Index extends BaseController // 获取参与考试的班级 if (count($src['banji_id']) == 0) { - $khSrc = new \app\kaohao\model\Search; + $khSrc = new \app\kaohao\model\SearchMore; $src['banji_id']= array_column($khSrc->cyBanji($src), 'id'); } diff --git a/app/chengji/controller/Luru.php b/app/chengji/controller/Luru.php index 882d4109..2ae193c7 100644 --- a/app/chengji/controller/Luru.php +++ b/app/chengji/controller/Luru.php @@ -129,7 +129,7 @@ class Luru extends BaseController $data = [ 'kaohao_id' => $list['kaohao_id'] ,'subject_id' => $list['subject_id'] - ,'user_id' => session('userid') + ,'user_id' => session('admin.userid') ,'defen' => $list['defen'] ,'defenlv' => $list['defen'] / $manfen * 100 ]; @@ -198,13 +198,13 @@ class Luru extends BaseController $cjone->defen = $list['newdefen']; $cjone->defenlv = $list['newdefen'] / $manfen * 100; - $cjone->user_id = session('userid'); + $cjone->user_id = session('admin.userid'); $data = $cjone->save(); } else { $data = [ 'kaohao_id' => $list['kaohao_id'] ,'subject_id' => $subject_id - ,'user_id' => session('userid') + ,'user_id' => session('admin.userid') ,'defen' => $list['newdefen'] ,'defenlv' => $list['newdefen'] / $manfen * 100 ]; @@ -309,7 +309,7 @@ class Luru extends BaseController } } - $user_id = session('userid'); # 获取用户id + $user_id = session('admin.userid'); # 获取用户id $data = array(); // 重新组合数组 diff --git a/app/chengji/model/Chengji.php b/app/chengji/model/Chengji.php index 4f6a717c..c5c08673 100644 --- a/app/chengji/model/Chengji.php +++ b/app/chengji/model/Chengji.php @@ -3,10 +3,10 @@ namespace app\chengji\model; // 引用基类 -use app\BaseModel; +use \app\kaoshi\model\KaoshiBase; -class Chengji extends BaseModel +class Chengji extends KaoshiBase { // 学科关联 public function subjectName() @@ -135,7 +135,7 @@ class Chengji extends BaseModel $src = array_cover($srcfrom, $src); // 实例化考号数据模型 - $khSrc = new \app\kaohao\model\Search; + $khSrc = new \app\kaohao\model\SearchMore; $chengjilist = $khSrc->srcChengjiList($src); return $chengjilist; diff --git a/app/chengji/model/Tongji.php b/app/chengji/model/Tongji.php index f306b1a6..4aa6312c 100644 --- a/app/chengji/model/Tongji.php +++ b/app/chengji/model/Tongji.php @@ -3,9 +3,9 @@ namespace app\chengji\model; // 引用基类 -use app\BaseModel; +use \app\kaoshi\model\KaoshiBase; -class Tongji extends BaseModel +class Tongji extends KaoshiBase { // 统计成绩 public function tongjiCnt($cj = array(), $subject_id) @@ -303,11 +303,16 @@ class Tongji extends BaseModel // 根据给定数据统计分数段 - public function fenshuduan($arr = array(), $manfen = 0) + public function fenshuduan($arr = array(), $manfen = 0, $cishu = 30) { + $cishu == '' ? $cishu = 20 : true; // 计算分数段 - $fenshuduan = array(); - $long = 5; + $long = round($manfen / $cishu, 3); + $fenshuduan[] = [ + 'low' => '-'.$long + ,'high' => 0 + ,'cnt' => 0 + ]; $cnt = 0; for($i = 0; $i <= $manfen; $i=$i+$long) { @@ -320,9 +325,13 @@ class Tongji extends BaseModel foreach ($arr as $key => $value) { $xiabiao = intval($value / $long); + if($xiabiao < 0){ + $fenshuduan[0]['cnt'] = $fenshuduan[0]['cnt'] + 1; + continue; + } if (isset($fenshuduan[$xiabiao])) { - $fenshuduan[$xiabiao]['cnt'] = $fenshuduan[$xiabiao]['cnt'] + 1; + $fenshuduan[$xiabiao + 1]['cnt'] = $fenshuduan[$xiabiao + 1]['cnt'] + 1; $cnt = $cnt + 1; } } diff --git a/app/chengji/model/TongjiBj.php b/app/chengji/model/TongjiBj.php index 6bc53355..71940bee 100644 --- a/app/chengji/model/TongjiBj.php +++ b/app/chengji/model/TongjiBj.php @@ -2,7 +2,7 @@ namespace app\chengji\model; // 引用基类 -use app\BaseModel; +use \app\kaoshi\model\KaoshiBase; // 引用学生成绩统计类 use app\chengji\model\Tongji as TJ; @@ -10,7 +10,7 @@ use app\chengji\model\Tongji as TJ; /** * @mixin think\Model */ -class TongjiBj extends BaseModel +class TongjiBj extends KaoshiBase { // 统计参加本次考试所有班级的成绩并保存 public function tjBanji($kaoshi_id) @@ -163,6 +163,7 @@ class TongjiBj extends BaseModel ,'banji_id' => array() ,'ruxuenian' => '' ,'subject_id' => '' + ,'cishu' => 20 ); $src = array_cover($srcfrom, $src); @@ -196,8 +197,7 @@ class TongjiBj extends BaseModel }); if (count($cjcol) > 0) { - - $data = $tj->fenshuduan($cjcol, $fsx); + $data = $tj->fenshuduan($cjcol, $fsx, $src['cishu']); } } diff --git a/app/chengji/model/TongjiNj.php b/app/chengji/model/TongjiNj.php index b7e7b576..3d68c72a 100644 --- a/app/chengji/model/TongjiNj.php +++ b/app/chengji/model/TongjiNj.php @@ -1,14 +1,14 @@ ['规则1','规则2'...] - * - * @var array - */ - protected $rule = []; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/app/chengji/view/bjtongji/fenshuduan.html b/app/chengji/view/bjtongji/fenshuduan.html index 7daa101b..ff2cd959 100644 --- a/app/chengji/view/bjtongji/fenshuduan.html +++ b/app/chengji/view/bjtongji/fenshuduan.html @@ -14,6 +14,15 @@ {/block} {block name="search"} +