diff --git a/app/admin/controller/AdminInfo.php b/app/admin/controller/AdminInfo.php index d7c3bdd1..b049093c 100644 --- a/app/admin/controller/AdminInfo.php +++ b/app/admin/controller/AdminInfo.php @@ -185,7 +185,7 @@ class AdminInfo extends AdminBase $data = $bzr->srcTeacher($src); $src['all'] = true; $cnt = $bzr->srcTeacher($src)->count(); - $data = reSetObject($data, $cnt); + $data = reset_data($data, $cnt); return json($data); } diff --git a/app/chengji/controller/Bjtongji.php b/app/chengji/controller/Bjtongji.php index 20691bdc..51eb7bdf 100755 --- a/app/chengji/controller/Bjtongji.php +++ b/app/chengji/controller/Bjtongji.php @@ -27,7 +27,7 @@ class Bjtongji extends AdminBase $list['kaoshi_id'] = $kaoshi_id; $list['kaoshititle'] = $ksinfo->title; $list['dataurl'] = '/chengji/bjtj/data'; - $list['tjxm'] = srcTjxm(12201); + $list['tjxm'] = src_tjxm(12201); // 模板赋值 $this->view->assign('list', $list); @@ -67,7 +67,7 @@ class Bjtongji extends AdminBase // 统计成绩 $btj = new BTJ; $data = $btj->search($src); - $data = reSetArray($data, $src); + $data = reset_data($data, $src); return json($data); } @@ -134,7 +134,7 @@ class Bjtongji extends AdminBase ,'ruxuenian' => '' ,'school_id' => array() ], 'POST'); - $src['school_id'] = strToarray($src['school_id']); + $src['school_id'] = str_to_array($src['school_id']); // 获取相关参数 ob_start(); @@ -177,7 +177,7 @@ class Bjtongji extends AdminBase ->setCategory("成绩管理"); //分类 // 设置要导出的项目、列名、起始行 - $sbjcol = srcTjxm(12202); + $sbjcol = src_tjxm(12202); $sbjcolcnt = count($sbjcol); $colname = excelColumnName(); $colcnt = $sbjcolcnt*count($xk)+3; @@ -678,7 +678,7 @@ class Bjtongji extends AdminBase $btj = new BTJ(); // 获取参考年级 $data = $btj->srcSubject($src); - $data = reSetArray($data, $src); + $data = reset_data($data, $src); return json($data); } diff --git a/app/chengji/controller/Index.php b/app/chengji/controller/Index.php index cea531a9..dd545c77 100755 --- a/app/chengji/controller/Index.php +++ b/app/chengji/controller/Index.php @@ -16,20 +16,23 @@ class Index extends AdminBase // 获取参加考试的年级和学科 $ksset = new \app\kaoshi\model\KaoshiSet; - $list['set']['nianji'] = $ksset->srcGrade($kaoshi_id); - $src['kaoshi_id'] = $kaoshi_id; + $src = [ + 'kaoshi_id' => $kaoshi_id + ,'all' => true + ]; + + $list['set']['nianji'] = $ksset->srcGrade($src); $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; $cy = new \app\kaohao\model\SearchCanYu; $list['set']['school_id'] = $cy->school($src); $list['kaoshi_id'] = $kaoshi_id; $list['dataurl'] = '/chengji/index/data'; - $list['tjxm'] = srcTjxm(12205); + $list['tjxm'] = src_tjxm(12205); // 模板赋值 $this->view->assign('list', $list); @@ -66,7 +69,9 @@ class Index extends AdminBase // 实例化并查询成绩 $cj = new Chengji; $data = $cj->search($src); - $data = reSetArray($data, $src); + $src['all'] = true; + $cnt = $data = $cj->search($src); + $data = reset_data($data, $cnt); return json($data); } @@ -265,8 +270,8 @@ class Index extends AdminBase $chengjiinfo = $more->srcChengjiList($src); $ksset = new \app\kaoshi\model\KaoshiSet; $subject_id = $ksset->srcSubject($src); - $tjxm_left = srcTjxm(12210); - $tjxm_right = srcTjxm(12206); + $tjxm_left = src_tjxm(12210); + $tjxm_right = src_tjxm(12206); // 获取考试标题 $ks = new \app\kaoshi\model\Kaoshi; @@ -566,8 +571,8 @@ class Index extends AdminBase $mf[$mf_v['id']]['jige'] = $mf_v['fenshuxian']['jige']; } - $tjxm_stu = srcTjxm(12211); # 统计项目 - $tjxm_bj = srcTjxm(12212); # 统计项目 + $tjxm_stu = src_tjxm(12211); # 统计项目 + $tjxm_bj = src_tjxm(12212); # 统计项目 $colname = excelColumnName(); // set_time_limit(0); diff --git a/app/chengji/controller/Njtongji.php b/app/chengji/controller/Njtongji.php index 2d34f374..9dc01d9d 100755 --- a/app/chengji/controller/Njtongji.php +++ b/app/chengji/controller/Njtongji.php @@ -31,7 +31,7 @@ class Njtongji extends AdminBase $list['kaoshi_id'] = $kaoshi_id; $list['kaoshititle'] = $ksinfo->title; $list['dataurl'] = '/chengji/njtj/data'; - $list['tjxm'] = srcTjxm(12203); + $list['tjxm'] = src_tjxm(12203); // 模板赋值 @@ -150,7 +150,7 @@ class Njtongji extends AdminBase ->setCategory("成绩管理"); //分类 // 设置导出项目、列表等 - $sbjcol = srcTjxm(12204); + $sbjcol = src_tjxm(12204); $sbjcolcnt = count($sbjcol); $colname = excelColumnName(); $colcnt = $sbjcolcnt * count($xk) + 3; diff --git a/app/chengji/controller/Tongji.php b/app/chengji/controller/Tongji.php index 216eafbb..48972dd1 100755 --- a/app/chengji/controller/Tongji.php +++ b/app/chengji/controller/Tongji.php @@ -27,7 +27,7 @@ class Tongji extends AdminBase $ksset = new \app\kaoshi\model\KaoshiSet; // 重新计算得分率 - $nj = $ksset->srcGrade($src['kaoshi_id']); # 获取参考年级 + $nj = $ksset->srcGrade($src); # 获取参考年级 foreach ($nj as $key => $value) { # 循环获取各年级参考学科 $src['ruxuenian'] = $value['ruxuenian']; $manfen = $ksset->srcSubject($src); # 获取本年级各学科满分 diff --git a/app/chengji/model/Chengji.php b/app/chengji/model/Chengji.php index 819abf10..54675502 100755 --- a/app/chengji/model/Chengji.php +++ b/app/chengji/model/Chengji.php @@ -8,12 +8,35 @@ use \app\BaseModel; class Chengji extends BaseModel { + // 设置字段信息 + protected $schema = [ + 'id' => 'int' + ,'kaohao_id' => 'int' + ,'user_id' => 'int' + ,'user_group' => 'varchar' + ,'subject_id' => 'int' + ,'defen' => 'decimal' + ,'defenlv' => 'decimal' + ,'bpaixu' => 'int' + ,'bweizhi' => 'decimal' + ,'xpaixu' => 'int' + ,'xweizhi' => 'decimal' + ,'qpaixu' => 'int' + ,'qweizhi' =>' decimal' + ,'create_time' =>'int' + ,'update_time' => 'int' + ,'delete_time' => 'int' + ,'status' => 'tinyint' + ]; + + // 学科关联 public function subjectName() { return $this->belongsTo('\app\teach\model\Subject','subject_id','id'); } + // 学科关联 public function cjAdmin() { @@ -41,9 +64,9 @@ class Chengji extends BaseModel ,'user_group' =>'' ); $src = array_cover($srcfrom, $src) ; - $src['kaoshi_id'] = strToarray($src['kaoshi_id']); - $src['banji_id'] = strToarray($src['banji_id']); - $src['subject_id'] = strToarray($src['subject_id']); + $src['kaoshi_id'] = str_to_array($src['kaoshi_id']); + $src['banji_id'] = str_to_array($src['banji_id']); + $src['subject_id'] = str_to_array($src['subject_id']); $khid = array(); if(count($src['kaoshi_id']) > 0 || count($src['banji_id']) > 0 || strlen($src['searchval']) > 0) diff --git a/app/chengji/model/Tongji.php b/app/chengji/model/Tongji.php index af46e04f..861643a7 100755 --- a/app/chengji/model/Tongji.php +++ b/app/chengji/model/Tongji.php @@ -7,10 +7,10 @@ use \app\BaseModel; class Tongji extends BaseModel { + // 统计成绩 public function tongjiCnt($cj = array(), $subject_id) { - // halt($cj); $data = array(); // 循环统计各学科成绩 foreach ($subject_id as $key => $value) { diff --git a/app/chengji/model/TongjiBj.php b/app/chengji/model/TongjiBj.php index 3aa0af07..bbc71013 100755 --- a/app/chengji/model/TongjiBj.php +++ b/app/chengji/model/TongjiBj.php @@ -17,6 +17,35 @@ use \app\kaoshi\model\KaoshiSet as ksset; */ class TongjiBj extends BaseModel { + // 设置字段信息 + protected $schema = [ + 'id' => 'int' + ,'kaoshi_id' => 'int' + ,'teacher_id' => 'int' + ,'banji_id' => 'int' + ,'subject_id' => 'int' + ,'stu_cnt' => 'int' + ,'chengji_cnt' => 'int' + ,'sum' => 'decimal' + ,'avg' => 'decimal' + ,'defenlv' => 'decimal' + ,'biaozhuncha' => 'decimal' + ,'youxiu' => 'int' + ,'jige' => 'int' + ,'max' => 'decimal' + ,'min' => 'decimal' + ,'q1' => 'decimal' + ,'q2' => 'decimal' + ,'q3' => 'decimal' + ,'zhongshu' => 'varchar' + ,'zhongweishu' => 'decimal' + ,'create_time' => 'int' + ,'update_time' => 'int' + ,'delete_time' => 'int' + ,'status' => 'tinyint' + ]; + + // 统计参加本次考试所有班级的成绩并保存 public function tjBanji($kaoshi_id) { @@ -26,7 +55,11 @@ class TongjiBj extends BaseModel $more = new More(); $cy = new Canyu(); $ksset = new ksset(); - $nianji = $ksset->srcGrade($kaoshi_id); + $src = [ + 'kaoshi_id' => $kaoshi_id + ,'all' => true + ]; + $nianji = $ksset->srcGrade($src); // 循环年级统计结果 $data = array(); @@ -122,8 +155,8 @@ class TongjiBj extends BaseModel ); $src = array_cover($srcfrom, $src); - $src['banji_id'] = strToArray($src['banji_id']); - $src['school_id'] = strToArray($src['school_id']); + $src['banji_id'] = str_to_array($src['banji_id']); + $src['school_id'] = str_to_array($src['school_id']); // 实例化学生成绩统计类 $tj = new TJ(); @@ -183,7 +216,7 @@ class TongjiBj extends BaseModel ); $src = array_cover($srcfrom, $src); - $src['banji_id'] = strToArray($src['banji_id']); + $src['banji_id'] = str_to_array($src['banji_id']); // 实例化学生成绩统计类 $tj = new TJ; @@ -295,7 +328,7 @@ class TongjiBj extends BaseModel ] ); $src = array_cover($srcfrom, $src); - $src['banji_id'] = strToarray($src['banji_id']); + $src['banji_id'] = str_to_array($src['banji_id']); $kaoshi_id = $src['kaoshi_id']; if(count($src['banji_id']) == 0){ @@ -356,9 +389,9 @@ class TongjiBj extends BaseModel ,'teacher_id' => '' ); $src = array_cover($srcfrom, $src); - $src['banji_id'] = strToarray($src['banji_id']); - $src['subject_id'] = strToarray($src['subject_id']); - $src['teacher_id'] = strToarray($src['teacher_id']); + $src['banji_id'] = str_to_array($src['banji_id']); + $src['subject_id'] = str_to_array($src['subject_id']); + $src['teacher_id'] = str_to_array($src['teacher_id']); $data = $this->where('kaoshi_id', $src['kaoshi_id']) ->when(count($src['banji_id']) > 0, function ($query) use($src) { @@ -401,9 +434,9 @@ class TongjiBj extends BaseModel ,'enddate' => '' ); $src = array_cover($srcfrom, $src); - $src['xueqi_id'] = strToarray($src['xueqi_id']); - $src['subject_id'] = strToarray($src['subject_id']); - $src['category_id'] = strToarray($src['category_id']); + $src['xueqi_id'] = str_to_array($src['xueqi_id']); + $src['subject_id'] = str_to_array($src['subject_id']); + $src['category_id'] = str_to_array($src['category_id']); if(isset($srcfrom['bfdate']) && strlen($srcfrom['bfdate'])>0) { @@ -528,8 +561,8 @@ class TongjiBj extends BaseModel ,'searchval' => '' ); $src = array_cover($srcfrom, $src); - $src['xueqi_id'] = strToarray($src['xueqi_id']); - $src['category_id'] = strToarray($src['category_id']); + $src['xueqi_id'] = str_to_array($src['xueqi_id']); + $src['category_id'] = str_to_array($src['category_id']); if(isset($srcfrom['bfdate']) && strlen($srcfrom['bfdate']) > 0) { $src['bfdate'] = $srcfrom['bfdate']; @@ -592,13 +625,14 @@ class TongjiBj extends BaseModel $ksset = new ksset(); $cj = new \app\chengji\model\Chengji; - $nianji = $ksset->srcGrade($kaoshi_id); + $src = [ + 'kaoshi_id' => $kaoshi_id + ,'all' => true + ]; + $nianji = $ksset->srcGrade($src); $col = ['bpaixu', 'bweizhi']; - $src = array( - 'kaoshi_id' => $kaoshi_id - ,'ruxuenian' => 0 - ); + $src['ruxuenian'] = 0; // 初始化统计结果 $data = array(); diff --git a/app/chengji/model/TongjiNj.php b/app/chengji/model/TongjiNj.php index e5f7392f..e7a1835c 100755 --- a/app/chengji/model/TongjiNj.php +++ b/app/chengji/model/TongjiNj.php @@ -10,6 +10,35 @@ use app\chengji\model\Tongji as TJ; */ class TongjiNj extends BaseModel { + // 设置字段信息 + protected $schema = [ + 'id' => 'int' + ,'school_id' => 'int' + ,'kaoshi_id' => 'int' + ,'ruxuenian' => 'int' + ,'subject_id' => 'int' + ,'stu_cnt' => 'int' + ,'chengji_cnt' => 'int' + ,'sum' => 'decimal' + ,'avg' => 'decimal' + ,'defenlv' => 'decimal' + ,'biaozhuncha' => 'decimal' + ,'youxiu' => 'int' + ,'jige' => 'int' + ,'max' => 'decimal' + ,'min' => 'decimal' + ,'q1' => 'decimal' + ,'q2' => 'decimal' + ,'q3' => 'decimal' + ,'zhongshu' => 'varchar' + ,'zhongweishu' => 'decimal' + ,'create_time' => 'int' + ,'update_time' => 'int' + ,'delete_time' => 'int' + ,'status' => 'tinyint' + ]; + + // 统计所有参加本次考试年级的成绩 public function tjNianji($kaoshi_id) { @@ -25,7 +54,11 @@ class TongjiNj extends BaseModel // } // 查询要统计的年级 $ksset = new \app\kaoshi\model\KaoshiSet; - $njList = $ksset->srcGrade($kaoshi_id); + $src = [ + 'kaoshi_id' => $kaoshi_id + ,'all' => true + ]; + $njList = $ksset->srcGrade($src); // 实例化学生成绩统计类 $tj = new TJ; @@ -209,14 +242,15 @@ class TongjiNj extends BaseModel $cy = new \app\kaohao\model\SearchCanYu; $more = new \app\kaohao\model\SearchMore; $ksset = new \app\kaoshi\model\KaoshiSet; + $src = [ + 'kaoshi_id' => $kaoshi_id + ,'all' => true + ]; $cj = new \app\chengji\model\Chengji; - $nianji = $ksset->srcGrade($kaoshi_id); + $nianji = $ksset->srcGrade($src); $col = ['xpaixu', 'xweizhi']; - $src = array( - 'kaoshi_id' => $kaoshi_id - ,'ruxuenian' => 0 - ); + $src['ruxuenian'] = 0; // 循环年级 $data = array(); diff --git a/app/chengji/model/TongjiSch.php b/app/chengji/model/TongjiSch.php index 79c8bd07..94c0b09d 100755 --- a/app/chengji/model/TongjiSch.php +++ b/app/chengji/model/TongjiSch.php @@ -10,6 +10,34 @@ use app\chengji\model\Tongji as TJ; */ class TongjiSch extends BaseModel { + // 设置字段信息 + protected $schema = [ + 'id' => 'int' + ,'kaoshi_id' => 'int' + ,'ruxuenian' => 'int' + ,'subject_id' => 'int' + ,'stu_cnt' => 'int' + ,'chengji_cnt' => 'int' + ,'sum' => 'decimal' + ,'avg' => 'decimal' + ,'defenlv' => 'decimal' + ,'biaozhuncha' => 'decimal' + ,'youxiu' => 'int' + ,'jige' => 'int' + ,'max' => 'decimal' + ,'min' => 'decimal' + ,'q1' => 'decimal' + ,'q2' => 'decimal' + ,'q3' => 'decimal' + ,'zhongshu' => 'varchar' + ,'zhongweishu' => 'decimal' + ,'create_time' => 'int' + ,'update_time' => 'int' + ,'delete_time' => 'int' + ,'status' => 'tinyint' + ]; + + // 统计参加本次考试所有学校成绩 public function tjSchool($kaoshi_id) { @@ -19,7 +47,11 @@ class TongjiSch extends BaseModel $more = new \app\kaohao\model\SearchMore; // 查询要统计的年级 $ksset = new \app\kaoshi\model\KaoshiSet; - $njList = $ksset->srcGrade($kaoshi_id); + $src = [ + 'kaoshi_id' => $kaoshi_id + ,'all' => true + ]; + $njList = $ksset->srcGrade($src); // 实例化学生成绩统计类 $tj = new TJ; @@ -176,7 +208,11 @@ class TongjiSch extends BaseModel $more = new \app\kaohao\model\SearchMore; $ksset = new \app\kaoshi\model\KaoshiSet; $cj = new \app\chengji\model\Chengji; - $nianji = $ksset->srcGrade($kaoshi_id); + $src = [ + 'kaoshi_id' => $kaoshi_id + ,'all' => true + ]; + $nianji = $ksset->srcGrade($src); // 循环年级 $data = array(); diff --git a/app/common.php b/app/common.php index 5d68a5c0..efc1af4c 100755 --- a/app/common.php +++ b/app/common.php @@ -82,7 +82,7 @@ */ function str_to_array($str) { - $data = \app\facade\Tools::strToArray($str); + $data = \app\facade\Tools::str_to_array($str); return $data; } @@ -108,7 +108,7 @@ // */ // function reset_array($arr, $srcfrom) // { - // $data = \app\facade\Tools::reSetArray($arr, $srcfrom); + // $data = \app\facade\Tools::reset_data($arr, $srcfrom); // return $data; // } diff --git a/app/kaohao/model/Kaohao.php b/app/kaohao/model/Kaohao.php index d85a67ef..c99e7581 100755 --- a/app/kaohao/model/Kaohao.php +++ b/app/kaohao/model/Kaohao.php @@ -91,8 +91,8 @@ class Kaohao extends BaseModel ,'searchval' => '' ); $src = array_cover($srcfrom, $src); - $src['ruxuenian'] = strToarray($src['ruxuenian']); - $src['subject_id'] = strToarray($src['subject_id']); + $src['ruxuenian'] = str_to_array($src['ruxuenian']); + $src['subject_id'] = str_to_array($src['subject_id']); $manfen = $ksset->search($src) ->visible([ @@ -110,7 +110,7 @@ class Kaohao extends BaseModel public function getBanTitleAttr() { $bj = new \app\teach\model\Banji; - $alias = \app\facade\System::sysClass(); + $alias = \app\facade\System::sysInfo(); if($alias->classalias) { $title = $bj->where('id', $this->getAttr('banji_id'))->value('alias'); diff --git a/app/kaohao/model/SearchCanYu.php b/app/kaohao/model/SearchCanYu.php index ef0c7a13..c82a8dc8 100755 --- a/app/kaohao/model/SearchCanYu.php +++ b/app/kaohao/model/SearchCanYu.php @@ -17,9 +17,16 @@ class SearchCanyu extends BaseModel $src = array( 'kaoshi_id' => '' ,'ruxuenian' => '' + ,'page' => '1' + ,'limit' => '10' + ,'field' => 'school_id' + ,'order' => 'asc' + ,'all' => false ); $src = array_cover($srcfrom, $src); - $src['ruxuenian'] = strToarray($src['ruxuenian']); + $src['ruxuenian'] = str_to_array($src['ruxuenian']); + + $src['orderSql'] = $this->schPaixu($src['field']); $kh = new kh; $schoolList = $kh->where('kaoshi_id', $src['kaoshi_id']) @@ -28,11 +35,16 @@ class SearchCanyu extends BaseModel }) ->with(['cjSchool' => function($query){ $query->field('id, jiancheng, paixu, title') - ->order(['paixu' => 'asc']); + ->order(['paixu' => 'asc']); } ]) ->distinct(true) ->field('school_id') + ->when($src['all'] == false, function ($query) use($src) { + $query + ->page($src['page'], $src['limit']); + }) + ->order($src['orderSql']) ->select(); // 重新整理参加学校信息 @@ -46,11 +58,6 @@ class SearchCanyu extends BaseModel ]; } - if(count($data) > 0) - { - $data = \app\facade\Tools::sortArrByManyField($data, 'paixu', SORT_ASC); - } - return $data; } @@ -70,11 +77,31 @@ class SearchCanyu extends BaseModel ,'ruxuenian' => array() ,'school_id' => array() ,'banji_id' => array() + ,'page' => '1' + ,'limit' => '10' + ,'field' => 'school_id' + ,'order' => 'asc' + ,'all' => false ); $src = array_cover($srcfrom, $src); - $src['school_id'] = strToarray($src['school_id']); - $src['banji_id'] = strToarray($src['banji_id']); - $src['ruxuenian'] = strToarray($src['ruxuenian']); + $src['school_id'] = str_to_array($src['school_id']); + $src['banji_id'] = str_to_array($src['banji_id']); + $src['ruxuenian'] = str_to_array($src['ruxuenian']); + + $src['orderSql'] = $this->schPaixu('school_id'); + $ks = new \app\kaoshi\model\Kaoshi; + $bjdate = $ks->where('id', $src['kaoshi_id'])->value('bfdate'); + $bj = new \app\teach\model\Banji; + $njList = $bj->gradeName($bjdate,'num'); + $bjList = $bj->where('ruxuenian', 'in', $njList) + ->order($src['orderSql']) + ->order(['ruxuenian' => 'asc']) + ->order(['paixu' => 'asc']) + ->column(['id']); + $paixuList = implode('\', \'', $bjList); + $paixuList = "field(banji_id, '". $paixuList. "')"; + $orderSql = \think\facade\Db::raw($paixuList); + // 通过给定参数,从考号表中获取参加考试的班级 $kh = new kh; @@ -101,9 +128,13 @@ class SearchCanyu extends BaseModel ,any_value(school_id) as school_id') ->group('banji_id') ->append(['banjiTitle', 'banTitle']) + ->when($src['all'] == false, function ($query) use($src) { + $query + ->page($src['page'], $src['limit']); + }) + ->order($orderSql) ->select(); - $bj = new \app\teach\model\Banji; $data = array(); foreach ($bjids as $key => $value) { $data[] = [ @@ -116,12 +147,29 @@ class SearchCanyu extends BaseModel 'banjiTitle'=>$value->banjiTitle, ]; } - if(count($data) > 0) - { - $data = \app\facade\Tools::sortArrByManyField($data, 'schPaixu', SORT_ASC, 'paixu', SORT_ASC); - } return $data; } + + /** + * 获取参加考试的班级 + * @access public + * @param number $kaoshi 考试id + * @param number $ruxuenian 入学年 + * @return array 返回班级数据模型 + */ + public function schPaixu($field) + { + $sch = new \app\system\model\School; + $schList = $sch->where('jibie_id', 10203) + ->order(['paixu' => 'asc']) + ->field('id, title, paixu') + ->column(['id']); + $paixuList = implode('\', \'', $schList); + $paixuList = "field(" . $field . ", '". $paixuList. "')"; + $orderSql = \think\facade\Db::raw($paixuList); + return $orderSql; + } + } \ No newline at end of file diff --git a/app/kaohao/model/SearchMore.php b/app/kaohao/model/SearchMore.php index e8af9a45..3a8bf607 100755 --- a/app/kaohao/model/SearchMore.php +++ b/app/kaohao/model/SearchMore.php @@ -29,7 +29,7 @@ class SearchMore extends BaseModel // 用新值替换初始值 $src = array_cover($srcfrom, $src); - $src['banji_id'] = strToArray($src['banji_id']); + $src['banji_id'] = str_to_array($src['banji_id']); // 查询成绩 $kh = new kh(); @@ -86,7 +86,7 @@ class SearchMore extends BaseModel // 用新值替换初始值 $src = array_cover($srcfrom, $src); - $src['banji_id'] = strToArray($src['banji_id']); + $src['banji_id'] = str_to_array($src['banji_id']); // 查询成绩 $kh = new kh(); @@ -301,7 +301,7 @@ class SearchMore extends BaseModel ); // 用新值替换初始值 $src = array_cover($srcfrom, $src); - $src['banji_id'] = strToArray($src['banji_id']); + $src['banji_id'] = str_to_array($src['banji_id']); // 获取考试标签 $kh = new kh; diff --git a/app/kaohao/model/SearchOne.php b/app/kaohao/model/SearchOne.php index db7122db..aed40889 100755 --- a/app/kaohao/model/SearchOne.php +++ b/app/kaohao/model/SearchOne.php @@ -22,9 +22,9 @@ class SearchOne extends BaseModel ,'searchval' => '' ); $src = array_cover($srcfrom, $src); - $src['category_id'] = strToArray($src['category_id']); - $src['xueqi_id'] = strToArray($src['xueqi_id']); - $src['kaoshi_id'] = strToArray($src['kaoshi_id']); + $src['category_id'] = str_to_array($src['category_id']); + $src['xueqi_id'] = str_to_array($src['xueqi_id']); + $src['kaoshi_id'] = str_to_array($src['kaoshi_id']); if(isset($srcfrom['bfdate']) && strlen($srcfrom['bfdate'])>0) { diff --git a/app/kaoshi/controller/Index.php b/app/kaoshi/controller/Index.php index fd3b78d1..6d07c3d1 100755 --- a/app/kaoshi/controller/Index.php +++ b/app/kaoshi/controller/Index.php @@ -435,15 +435,24 @@ class Index extends AdminBase // 获取允许录入成绩的考试 public function srcEditKaoshi() { + $src = [ + 'page' => 1 + ,'limit' => 10 + ,'field' => 'id' + ,'order' => 'desc' + ,'luru' => true + ,'status' => true + ]; $ks = new KS(); - // 获取参考年级 - $data = $ks->order(['id' => 'desc']) - ->field('id, title') - ->where('luru', 1) - ->where('status', 1) - ->select(); - $src = array(); - $data = reSetObject($data, $src); + // 获取考试 + $data = $ks->search($src) + ->visible([ + 'id' + ,'title' + ]); + $src['all'] = true; + $cnt = $ks->search($src)->count(); + $data = reset_data($data, $cnt); return json($data); } } diff --git a/app/kaoshi/controller/KsCanyu.php b/app/kaoshi/controller/KsCanyu.php index 85cf1405..b7f58fee 100644 --- a/app/kaoshi/controller/KsCanyu.php +++ b/app/kaoshi/controller/KsCanyu.php @@ -18,17 +18,17 @@ class KsCanYu extends AdminBase ,'kaoshi_id' => '' ,'page' => '1' ,'limit' => '10' - ,'field' => 'id' + ,'field' => 'school_id' ,'order' => 'desc' ], 'POST'); $cy = new \app\kaohao\model\SearchCanYu; $school = $cy->school($src); $src['all'] = true; - $cnt = $cy->school($src)->count(); - $data = reset_data($data, $cnt); + $cnt = count($cy->school($src)); + $data = reset_data($school, $cnt); - return json($school); + return json($data); } @@ -63,40 +63,43 @@ class KsCanYu extends AdminBase 'school_id' => '' ,'ruxuenian' => '' ,'kaoshi_id' => '' - ,'limit' => 100 + ,'page' => '1' + ,'limit' => '10' + ,'field' => 'school_id' + ,'order' => 'desc' ], 'POST'); $khSrc = new \app\kaohao\model\SearchCanYu; $bj = $khSrc->class($src); $src['all'] = true; - $cnt = $cy->class($src)->count(); - $data = reset_data($data, $cnt); + $cnt = count($khSrc->class($src)); + $data = reset_data($bj, $cnt); - return json($bj); + return json($data); } - // 根据考试ID和年级获取参加考试班级 - public function tjClass() - { - // 获取参数 - $src = $this->request - ->only([ - 'school_id' => '' - ,'ruxuenian' => '' - ,'kaoshi_id' => '' - ,'subject_id' => '' - ,'limit' => 100 - ], 'POST'); + // // 根据考试ID和年级获取参加考试班级 + // public function tjClass() + // { + // // 获取参数 + // $src = $this->request + // ->only([ + // 'school_id' => '' + // ,'ruxuenian' => '' + // ,'kaoshi_id' => '' + // ,'subject_id' => '' + // ,'limit' => 100 + // ], 'POST'); - $khSrc = new \app\chengji\model\TongjiBj; - $bj = $khSrc->searchSubjedt($src); - $src['all'] = true; - $cnt = $khSrc->searchSubjedt($src)->count(); - $data = reset_data($data, $cnt); + // $khSrc = new \app\chengji\model\TongjiBj; + // $bj = $khSrc->searchSubjedt($src); + // $src['all'] = true; + // $cnt = $khSrc->searchSubjedt($src)->count(); + // $data = reset_data($data, $cnt); - return json($bj); - } + // return json($bj); + // } // 根据考试ID和年级获取已经参加本次考试学科 diff --git a/app/kaoshi/controller/LuruFengong.php b/app/kaoshi/controller/LuruFengong.php index 91577364..f7d7e33b 100644 --- a/app/kaoshi/controller/LuruFengong.php +++ b/app/kaoshi/controller/LuruFengong.php @@ -26,9 +26,12 @@ class LuruFengong extends AdminBase $list['kaoshi_id'] = $kaoshi_id; $ksset = new ksset; - $src['kaoshi_id'] = $kaoshi_id; + $src = [ + 'kaoshi_id' => $kaoshi_id + ,'all' => true + ]; $list['subject'] = $ksset->srcSubject($src); - $nj = $ksset->srcGrade($kaoshi_id); + $nj = $ksset->srcGrade($src); $list['nj'] = $nj; $kaoshi = new \app\kaoshi\model\Kaoshi; $list['sj'] = $kaoshi::where('id', $kaoshi_id)->value('bfdate'); @@ -53,7 +56,7 @@ class LuruFengong extends AdminBase ,'ruxuenian' => '' ,'page' => '1' ,'limit' => '10' - ,'field' => 'update_id' + ,'field' => 'update_time' ,'order' => 'asc' ,'searchval' => '' ], 'POST'); @@ -220,7 +223,7 @@ class LuruFengong extends AdminBase ], 'POST'); $lrfg = new \app\kaoshi\model\LuruFengong; $bj = $lrfg->srcMyLuruBanji($src); - $bj = reSetArray($bj, $src); + $bj = reset_data($bj, $src); return json($bj); } @@ -238,7 +241,7 @@ class LuruFengong extends AdminBase ], 'POST'); $lrfg = new \app\kaoshi\model\LuruFengong; $bj = $lrfg->srcMyLuruSubject($src); - $bj = reSetArray($bj, $src); + $bj = reset_data($bj, $src); return json($bj); } } diff --git a/app/kaoshi/model/Kaoshi.php b/app/kaoshi/model/Kaoshi.php index 016b76be..a5a2627f 100755 --- a/app/kaoshi/model/Kaoshi.php +++ b/app/kaoshi/model/Kaoshi.php @@ -32,12 +32,12 @@ class Kaoshi extends BaseModel public function search($srcfrom) { $src = [ - 'field' => 'id' - ,'order' => 'desc' - ,'id' => array() + 'id' => array() ,'zuzhi_id' => array() ,'xueqi_id' => '' ,'category_id' => array() + ,'luru' => '' + ,'status' => '' ,'searchval' => '' ,'page' => 1 ,'limit' => 10 @@ -74,6 +74,12 @@ class Kaoshi extends BaseModel ->when(session('user_id') !=1 && session('user_id') !=2, function($query) use($src){ $query->where('id', 'in', $src['id']); }) + ->when(strlen($src['luru']) > 0, function ($query) use($src) { + $query->where('luru', $src['luru']); + }) + ->when(strlen($src['status']) > 0, function ($query) use($src) { + $query->where('status', $src['status']); + }) ->with( [ 'ksCategory' => function ($query) { diff --git a/app/kaoshi/model/TongjiLog.php b/app/kaoshi/model/TongjiLog.php index efdb69af..564ca59f 100755 --- a/app/kaoshi/model/TongjiLog.php +++ b/app/kaoshi/model/TongjiLog.php @@ -27,8 +27,8 @@ class TongjiLog extends BaseModel public function search($srcfrom) { $src = [ - 'kaoshi_id' => '', - 'cjlast' => 0, + 'kaoshi_id' => '' + ,'cjlast' => 0 ,'page' => 1 ,'limit' => 10 ,'field' => 'id' diff --git a/app/kaoshi/route/kaoshi.php b/app/kaoshi/route/kaoshi.php index 4b7f07f6..5492d4f1 100755 --- a/app/kaoshi/route/kaoshi.php +++ b/app/kaoshi/route/kaoshi.php @@ -85,7 +85,7 @@ Route::group('kscy', function () { Route::rule('school','KsCanyu/school','post'); # 参与学科 Route::rule('grade','KsCanyu/grade','post'); # 参与学科 Route::rule('class','KsCanyu/class','post'); # 参与学科 - Route::rule('tjclass','KsCanyu/tjClass','post'); # 参与学科 + // Route::rule('tjclass','KsCanyu/tjClass','post'); # 参与学科 Route::rule('subject','KsCanyu/subject','post'); # 参与学科 }); diff --git a/app/kaoshi/view/luru_fengong/index.html b/app/kaoshi/view/luru_fengong/index.html index 97676162..67185e87 100644 --- a/app/kaoshi/view/luru_fengong/index.html +++ b/app/kaoshi/view/luru_fengong/index.html @@ -20,7 +20,7 @@