diff --git a/app/chengji/controller/Luru.php b/app/chengji/controller/Luru.php index 4c0f3048..c003ffac 100644 --- a/app/chengji/controller/Luru.php +++ b/app/chengji/controller/Luru.php @@ -17,26 +17,6 @@ class Luru extends BaseController public function index() { - $ks = new \app\kaoshi\model\Kaoshi; - // 获取参考年级 - $list['data'] = $ks::order(['id'=>'desc']) - ->field('id,title') - ->with([ - 'ksNianji' - ,'ksSubject'=>function($query){ - $query->field('id,subjectid,kaoshiid') - ->with(['subjectName'=>function($q){ - $q->field('id,title'); - }] - ); - } - ]) - ->limit(6) - ->select() - ->toArray(); - - - // 设置要给模板赋值的信息 $list['webtitle'] = '已录列表'; $list['dataurl'] = 'luru/data'; @@ -188,6 +168,7 @@ class Luru extends BaseController ,'post'); $list['kaohao_id'] = $id; + // 判断考试结束时间是否已过 $kaoshiid = Kaohao::where('id',$list['kaohao_id'])->value('kaoshi'); $enddate = kaoshiDate($kaoshiid,'enddate'); diff --git a/app/chengji/model/Chengji.php b/app/chengji/model/Chengji.php index a2967147..3ccb9f79 100644 --- a/app/chengji/model/Chengji.php +++ b/app/chengji/model/Chengji.php @@ -40,7 +40,7 @@ class Chengji extends Base 'kaoshi'=>'0', 'banji'=>array(), 'subject_id'=>array(), - 'searchval'=>array(), + 'searchval'=>'', 'user_id'=>session('userid'), ); @@ -51,6 +51,18 @@ class Chengji extends Base $kaoshi = $src['kaoshi']; $searchval = $src['searchval']; + $ks = new \app\kaoshi\model\Kaoshi; + $bfdate = $ks->where('id',$kaoshi) + ->value('bfdate'); + $nj = nianjiList($bfdate); + $stu = new \app\renshi\model\Student; + $stuid = $stu + ->when(strlen($searchval)>0,function($query)use($searchval){ + $query->where('xingming','like','%'.$searchval.'%') + ->field('id'); + }) + ->column('id'); + $nianji = nianjiList(); $cjList = $this @@ -58,11 +70,19 @@ class Chengji extends Base ->when(count($subject_id)>0,function($query)use($subject_id){ $query->where('subjectid','in',$subject_id); }) + ->when(count($stuid)>0,function($query)use($stuid){ + $query->where('kaohao_id','in',function($q)use($stuid){ + $q->name('kaohao') + ->where('student','in',$stuid) + ->whereTime('update_time','-480 hours') + ->field('id'); + }); + }) ->with([ 'subjectName'=>function($query){ $query->field('id,title,lieming'); } - ,'cjKaohao'=>function($query){ + ,'cjKaohao'=>function($query)use($searchval){ $query->field('id,kaoshi,school,ruxuenian,nianji,banji,paixu,student') ->append(['banjiTitle']) ->with([ @@ -89,12 +109,14 @@ class Chengji extends Base 'id'=>$value->id, 'kaoshi'=>$value->cjKaohao->cjKaoshi->title, 'kaoshiid'=>$value->cjKaohao->cjKaoshi->id, + 'kaohaoid'=>$value->cjKaohao->id, 'school'=>$value->cjKaohao->cjSchool->jiancheng, 'schoolid'=>$value->cjKaohao->cjSchool->paixu, 'banji'=>$value->cjKaohao->banjiTitle, 'banjiid'=>$value->cjKaohao->banji, 'subject'=>$value->subjectName->title, - 'subjectid'=>$value->subjectid, + 'subjectid'=>$value->id, + 'subjectname'=>$value->subjectName->lieming, 'defen'=>$value->defen, 'status'=>$value->status, 'update_time'=>$value->update_time, diff --git a/app/chengji/view/luru/index.html b/app/chengji/view/luru/index.html index d7deb2d2..81558541 100644 --- a/app/chengji/view/luru/index.html +++ b/app/chengji/view/luru/index.html @@ -11,34 +11,14 @@ {/block} {block name="search"}