|
@@ -123,6 +123,7 @@ class Collection extends Backend
|
|
|
$info = $this->exam_model->where(['user_id'=>$this->auth->id,'exam_collection_id'=>$ids,'exam_collection_type'=>3,'endtime'=>0])->find();
|
|
|
if(!empty($info)){
|
|
|
$this->exam_model->where('exam_id',$info['exam_id'])->update(['seat_id'=>$this->auth->seat_id,'sim_id'=>$this->auth->sim_id]);
|
|
|
+ $info['seat_id'] = $this->auth->seat_id;
|
|
|
$sim = Db::name('sim')->where('seat_id',$this->auth->seat_id)->find();
|
|
|
$sim_text = '';
|
|
|
// 模拟器状态 0:可用初始化 1:在线 2:模拟器离线 3:网关离线 4:硬件故障异常 5:手动禁用
|
|
@@ -157,6 +158,7 @@ class Collection extends Backend
|
|
|
$this->view->assign('info', $info);
|
|
|
$this->view->assign('row', $row);
|
|
|
$this->assignConfig('exam_id', $info['exam_id']);
|
|
|
+ $this->assignConfig('url_type', config('site.url_type'));
|
|
|
return $this->view->fetch();
|
|
|
}
|
|
|
|
|
@@ -168,6 +170,11 @@ class Collection extends Backend
|
|
|
}
|
|
|
if ($this->request->isPost()) {
|
|
|
//先请求接口判断,再进行处理
|
|
|
+ $url = config('site.url_type').'/sim/real-exam-collection/teacher/exam/open/'.$ids;
|
|
|
+ $ret = json_decode(send_get($url),true);
|
|
|
+ if($ret['code']!=200){
|
|
|
+ $this->error($ret['msg']);
|
|
|
+ }
|
|
|
|
|
|
//计算分数,保存记录
|
|
|
$params = $this->request->post('row/a');
|
|
@@ -204,20 +211,20 @@ class Collection extends Backend
|
|
|
|
|
|
|
|
|
//更新故障是否正确
|
|
|
-// $fault_list = Db::name('real_exam_fault')->where(['exam_id'=>$ids,'flag'=>1])->select();
|
|
|
-// if(!empty($fault_list)){
|
|
|
-// foreach ($fault_list as $k =>$t){
|
|
|
-// $answer_right = 0;
|
|
|
-// if(!empty($t['sim_fault_question_value']) && !empty($t['sim_fault_answer_value'])){
|
|
|
-// if($t['sim_fault_question_value']==$t['sim_fault_answer_value']){
|
|
|
-// $answer_right=1;
|
|
|
-// }else{
|
|
|
-// $answer_right=2;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// Db::name('real_exam_fault')->where(['ref_id'=>$t['ref_id']])->update(['answer_right'=>$answer_right]);
|
|
|
-// }
|
|
|
-// }
|
|
|
+ $fault_list = Db::name('real_exam_fault')->where(['exam_id'=>$ids,'flag'=>1])->select();
|
|
|
+ if(!empty($fault_list)){
|
|
|
+ foreach ($fault_list as $k =>$t){
|
|
|
+ $answer_right = 0;
|
|
|
+ if(!empty($t['sim_fault_question_value']) && !empty($t['sim_fault_answer_value'])){
|
|
|
+ if($t['sim_fault_question_value']==$t['sim_fault_answer_value']){
|
|
|
+ $answer_right=1;
|
|
|
+ }else{
|
|
|
+ $answer_right=2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Db::name('real_exam_fault')->where(['ref_id'=>$t['ref_id']])->update(['answer_right'=>$answer_right]);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
//计算得分,故障是否有扣分 扣分制
|
|
@@ -238,12 +245,12 @@ class Collection extends Backend
|
|
|
$partent_fault_id = Fault::where(['fault_id'=>['in',$fault_arr]])->column('parent_fault_id');
|
|
|
|
|
|
//故障保存的是部位,需要查找故障现象
|
|
|
- $report = json_decode($params['other_report'],true);
|
|
|
- if(count($report)<3){
|
|
|
+ $other_report = json_decode($params['other_report'],true);
|
|
|
+ if(count($other_report)<3){
|
|
|
$xianxian_score = 5;
|
|
|
}else{
|
|
|
- foreach ($report as $key => $em){
|
|
|
-// //故障现象
|
|
|
+ foreach ($other_report as $key => $em){
|
|
|
+ //故障现象
|
|
|
if(!in_array($em['xx_id'],$partent_fault_id)){
|
|
|
$xianxian_score = 5+$xianxian_score;
|
|
|
$xianxian_arr[] = $em['xx_id'];
|
|
@@ -252,46 +259,66 @@ class Collection extends Backend
|
|
|
|
|
|
//故障部位
|
|
|
if(!empty($em['bw_id'])){
|
|
|
- $report = Report::where('bw_id',$em['bw_id'])->find();
|
|
|
- if(empty($report) || $report['bw_type']==30){
|
|
|
+ $report_xx_id = Report::where(['bw_id'=>['in',$em['bw_id']]])->column('xx_id');
|
|
|
+ if(!in_array($em['xx_id'],$report_xx_id)){ //现象不对,直接扣分
|
|
|
$buwei_score = 1+$buwei_score;
|
|
|
-// array_push($buwei_arr,$em['bw_id']);
|
|
|
$buwei_arr[] = $em['bw_id'];
|
|
|
-// echo "这里是假的部位扣了+1分<br/>";
|
|
|
+ echo "这里是假1的部位扣了+1分<br/>";
|
|
|
+ }else{
|
|
|
+ //现象正确,判断是不是正确的选项
|
|
|
+ foreach (explode(',',$em['bw_id']) as $s => $bs){
|
|
|
+ if(!in_array($bs,$fault_arr)){
|
|
|
+ $buwei_score = 1+$buwei_score;
|
|
|
+ $buwei_arr[] = $bs;
|
|
|
+ echo "这里是假2的部位扣了+1分<br/>";
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+// $report = Report::where('bw_id',$em['bw_id'])->find();
|
|
|
+// if(empty($report) || $report['bw_type']==30){
|
|
|
+// $buwei_score = 1+$buwei_score;
|
|
|
+//// array_push($buwei_arr,$em['bw_id']);
|
|
|
+// $buwei_arr[] = $em['bw_id'];
|
|
|
+//// echo "这里是假的部位扣了+1分<br/>";
|
|
|
+// }
|
|
|
// if(!empty($em['yy_id']) && !empty($report)){
|
|
|
// if($report['bw_type']!=3 || $report['yy_id']!=$em['yy_id'] ){
|
|
|
// $buwei_score = 1+$buwei_score;
|
|
|
// echo "这里错误扣了+1分<br/>";
|
|
|
// }
|
|
|
// }
|
|
|
-
|
|
|
}else{
|
|
|
//部位为空 +1
|
|
|
$buwei_score = 1+ $buwei_score;
|
|
|
// $buwei_arr[] = '';
|
|
|
-// array_push($buwei_arr,'');
|
|
|
// echo "这里为空扣了+1分<br/>";
|
|
|
}
|
|
|
|
|
|
|
|
|
//可能原因
|
|
|
if(!empty($em['yy_id'])){
|
|
|
- $report = Report::where('yy_id',$em['yy_id'])->find();
|
|
|
- if(empty($report) || $report['bw_type']==30){
|
|
|
- $yuanyin_socre = 1+ $yuanyin_socre;
|
|
|
-// echo "这里是假的部位扣了+1分<br/>";
|
|
|
-// array_push($yuanyin_arr,$em['yy_id']);
|
|
|
+ $report_bw_id = Report::where(['yy_id'=>['in',$em['yy_id']]])->column('bw_id');
|
|
|
+ if(!in_array($em['bw_id'],$report_bw_id)){ //现象不对,直接扣分
|
|
|
+ $yuanyin_socre = 1+$yuanyin_socre;
|
|
|
$yuanyin_arr[] = $em['yy_id'];
|
|
|
+ }else{
|
|
|
+
|
|
|
}
|
|
|
- if(!empty($em['yy_id']) && !empty($report)){
|
|
|
- if($report['bw_id']!=$em['bw_id'] ){
|
|
|
- $yuanyin_socre = 1+$yuanyin_socre;
|
|
|
-// echo "这里错误扣了+1分<br/>";
|
|
|
-// array_push($yuanyin_arr,$em['yy_id']);
|
|
|
- $yuanyin_arr[] = $em['yy_id'];
|
|
|
- }
|
|
|
- }
|
|
|
+// $report = Report::where('yy_id',$em['yy_id'])->find();
|
|
|
+// if(empty($report) || $report['bw_type']==30){
|
|
|
+// $yuanyin_socre = 1+ $yuanyin_socre;
|
|
|
+//// echo "这里是假的部位扣了+1分<br/>";
|
|
|
+//// array_push($yuanyin_arr,$em['yy_id']);
|
|
|
+// $yuanyin_arr[] = $em['yy_id'];
|
|
|
+// }
|
|
|
+// if(!empty($em['yy_id']) && !empty($report)){
|
|
|
+// if($report['bw_id']!=$em['bw_id'] ){
|
|
|
+// $yuanyin_socre = 1+$yuanyin_socre;
|
|
|
+//// echo "这里错误扣了+1分<br/>";
|
|
|
+//// array_push($yuanyin_arr,$em['yy_id']);
|
|
|
+// $yuanyin_arr[] = $em['yy_id'];
|
|
|
+// }
|
|
|
+// }
|
|
|
}else{
|
|
|
//部位为空 +1
|
|
|
$yuanyin_socre = 1+$yuanyin_socre;
|
|
@@ -299,24 +326,32 @@ class Collection extends Backend
|
|
|
// echo "这里为空扣了+1分<br/>";
|
|
|
// $yuanyin_arr[] = '';
|
|
|
}
|
|
|
+
|
|
|
//排除方法
|
|
|
if(!empty($em['pc_id'])){
|
|
|
- $report = Report::where('pc_id',$em['pc_id'])->find();
|
|
|
- if(empty($report) || $report['bw_type']==30){
|
|
|
- $fangfa_score = 1+ $fangfa_score;
|
|
|
-
|
|
|
+ $report_pc_id = Report::where(['pc_id'=>['in',$em['pc_id']]])->column('bw_id');
|
|
|
+ if(!in_array($em['bw_id'],$report_pc_id)){ //现象不对,直接扣分
|
|
|
+ $fangfa_score = 1+$fangfa_score;
|
|
|
$fangfa_arr[] = $em['pc_id'];
|
|
|
-// array_push($fangfa_arr,$em['pc_id']);
|
|
|
-// echo "这里是假的方法扣了+1分<br/>";
|
|
|
- }
|
|
|
- if(!empty($em['pc_id']) && !empty($report)){
|
|
|
- if($report['bw_id']!=$em['bw_id'] ){
|
|
|
- $fangfa_score = 1+$fangfa_score;
|
|
|
- $fangfa_arr[] = $em['pc_id'];
|
|
|
-// array_push($fangfa_arr,$em['pc_id']);
|
|
|
-// echo "这里错误扣了+1分<br/>";
|
|
|
- }
|
|
|
+ }else{
|
|
|
+
|
|
|
}
|
|
|
+// $report = Report::where('pc_id',$em['pc_id'])->find();
|
|
|
+// if(empty($report) || $report['bw_type']==30){
|
|
|
+// $fangfa_score = 1+ $fangfa_score;
|
|
|
+//
|
|
|
+// $fangfa_arr[] = $em['pc_id'];
|
|
|
+//// array_push($fangfa_arr,$em['pc_id']);
|
|
|
+//// echo "这里是假的方法扣了+1分<br/>";
|
|
|
+// }
|
|
|
+// if(!empty($em['pc_id']) && !empty($report)){
|
|
|
+// if($report['bw_id']!=$em['bw_id'] ){
|
|
|
+// $fangfa_score = 1+$fangfa_score;
|
|
|
+// $fangfa_arr[] = $em['pc_id'];
|
|
|
+//// array_push($fangfa_arr,$em['pc_id']);
|
|
|
+//// echo "这里错误扣了+1分<br/>";
|
|
|
+// }
|
|
|
+// }
|
|
|
}else{
|
|
|
$fangfa_score = 1+$fangfa_score;
|
|
|
// array_push($yuanyin_arr,'');
|
|
@@ -329,7 +364,10 @@ class Collection extends Backend
|
|
|
// echo '方法:'.$fangfa_score.'<br/>';
|
|
|
}
|
|
|
}
|
|
|
-// halt($yuanyin_arr);
|
|
|
+// echo "<pre>";
|
|
|
+// print_r($buwei_arr);
|
|
|
+// echo '原因:'.$yuanyin_socre.'<br/>';
|
|
|
+// echo '部位:'.$buwei_score.'<br/>';
|
|
|
// echo '现象:'.$xianxian_score;
|
|
|
// die();
|
|
|
$weixiu_score = $xianxian_score+$yuanyin_socre+$buwei_score+$fangfa_score;
|