|
@@ -155,7 +155,7 @@ class Collection extends Backend
|
|
return $this->view->fetch();
|
|
return $this->view->fetch();
|
|
}
|
|
}
|
|
|
|
|
|
- public function examing($ids = null)
|
|
|
|
|
|
+ public function examing($ids = null)
|
|
{
|
|
{
|
|
$row = $this->exam_model->get($ids);
|
|
$row = $this->exam_model->get($ids);
|
|
if(!$row){
|
|
if(!$row){
|
|
@@ -166,7 +166,6 @@ class Collection extends Backend
|
|
if(Env::get('app.is_fault')){
|
|
if(Env::get('app.is_fault')){
|
|
$url = config('site.url_type').'/sim/real-exam/student/exam/submit/'.$ids;
|
|
$url = config('site.url_type').'/sim/real-exam/student/exam/submit/'.$ids;
|
|
$ret = json_decode(send_get($url),true);
|
|
$ret = json_decode(send_get($url),true);
|
|
- // halt($ret);
|
|
|
|
if($ret['code']!=200){
|
|
if($ret['code']!=200){
|
|
$this->error($ret['msg']);
|
|
$this->error($ret['msg']);
|
|
}
|
|
}
|
|
@@ -244,23 +243,16 @@ class Collection extends Backend
|
|
|
|
|
|
//根据故障部位 数组
|
|
//根据故障部位 数组
|
|
$fault_arr = [$fault_right_list[0]['fault_id'],$fault_right_list[1]['fault_id'],$fault_right_list[2]['fault_id']];
|
|
$fault_arr = [$fault_right_list[0]['fault_id'],$fault_right_list[1]['fault_id'],$fault_right_list[2]['fault_id']];
|
|
|
|
+
|
|
//根据故障部位查找,匹配的排除方法
|
|
//根据故障部位查找,匹配的排除方法
|
|
$paichu_arr = Report::where(['bw_id'=>['in',$fault_arr]])->column('pc_id');
|
|
$paichu_arr = Report::where(['bw_id'=>['in',$fault_arr]])->column('pc_id');
|
|
//根据故障部位查找,匹配可能原因
|
|
//根据故障部位查找,匹配可能原因
|
|
$yy_arr = Report::where(['bw_id'=>['in',$fault_arr]])->column('yy_id');
|
|
$yy_arr = Report::where(['bw_id'=>['in',$fault_arr]])->column('yy_id');
|
|
|
|
+
|
|
//查找故障现象 数组
|
|
//查找故障现象 数组
|
|
$partent_fault_id = Fault::where(['fault_id'=>['in',$fault_arr]])->column('parent_fault_id');
|
|
$partent_fault_id = Fault::where(['fault_id'=>['in',$fault_arr]])->column('parent_fault_id');
|
|
|
|
|
|
- $issetValue = '';
|
|
|
|
- $issetValue_count = 0;
|
|
|
|
- //出题的 判断故障现象 是否有重复的,拿出重复的fault_id 和重复次数
|
|
|
|
- $countedValues = array_count_values($partent_fault_id);
|
|
|
|
- foreach ($countedValues as $value => $count) {
|
|
|
|
- if ($count > 1) {
|
|
|
|
- $issetValue = $value;
|
|
|
|
- $issetValue_count = $count;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ //获取数组
|
|
$other_report = json_decode($params['other_report'],true);
|
|
$other_report = json_decode($params['other_report'],true);
|
|
if(!empty($other_report)){
|
|
if(!empty($other_report)){
|
|
foreach ($other_report as $key => $em){
|
|
foreach ($other_report as $key => $em){
|
|
@@ -274,95 +266,30 @@ class Collection extends Backend
|
|
$fangfa_arr[] = $em['pc_id'];
|
|
$fangfa_arr[] = $em['pc_id'];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- $xxValue = '';
|
|
|
|
- $xxValue_count = 0;
|
|
|
|
- //维修报告 判断故障现象 是否有重复的,拿出重复的fault_id 和重复次数
|
|
|
|
- $xxcountedValues = array_count_values($xianxian_arr);
|
|
|
|
- foreach ($xxcountedValues as $v => $t) {
|
|
|
|
- if ($t > 1) {
|
|
|
|
- $xxValue = $v;
|
|
|
|
- $xxValue_count = $t;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //故障现象 判断数量是否一致,
|
|
|
|
- if(count($partent_fault_id)!=count($xianxian_arr)){
|
|
|
|
- foreach ($partent_fault_id as $k0 =>$t0){
|
|
|
|
- if(!in_array($t0,$xianxian_arr)){
|
|
|
|
- //错写
|
|
|
|
- $xianxian_score = 1+$xianxian_score;
|
|
|
|
-// echo "错写:".$t0."@@@@".$xianxian_score."<br/>";
|
|
|
|
- $xianxian_content[] = [
|
|
|
|
- 'cx_id'=>$t0,
|
|
|
|
- 'cx_type'=>'错写',
|
|
|
|
- 'cx_name'=>Fault::where(['fault_id'=>$t0])->value('name'),
|
|
|
|
- ];
|
|
|
|
- $xianxian_score = 1+$xianxian_score;
|
|
|
|
-// echo "少写:".$t0."@@@@".$xianxian_score."<br/>";
|
|
|
|
- $xianxian_content[] = [
|
|
|
|
- 'cx_id'=>$t0,
|
|
|
|
- 'cx_type'=>'少写',
|
|
|
|
- 'cx_name'=>Fault::where(['fault_id'=>$t0])->value('name'),
|
|
|
|
- ];
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- foreach ($xianxian_arr as $k01 =>$t01){
|
|
|
|
- if(!in_array($t01,$partent_fault_id)){
|
|
|
|
- $xianxian_score = 1+$xianxian_score;
|
|
|
|
-// echo "多写:".$t01."@@@@".$xianxian_score."<br/>";
|
|
|
|
- $xianxian_content[] = [
|
|
|
|
- 'cx_id'=>$t01,
|
|
|
|
- 'cx_type'=>'多写',
|
|
|
|
- 'cx_name'=>Fault::where(['fault_id'=>$t01])->value('name'),
|
|
|
|
- ];
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }else{ //数量相同
|
|
|
|
- //计算故障现象分数
|
|
|
|
- foreach ($partent_fault_id as $k1 =>$t){
|
|
|
|
- if(!in_array($t,$xianxian_arr)){
|
|
|
|
- $xianxian_score = 1+$xianxian_score;
|
|
|
|
- $xianxian_content[] = [
|
|
|
|
- 'cx_id'=>$t,
|
|
|
|
- 'cx_type'=>'少写',
|
|
|
|
- 'cx_name'=>Fault::where(['fault_id'=>$t])->value('name'),
|
|
|
|
- ];
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- foreach ($xianxian_arr as $k2 =>$t2){
|
|
|
|
- if(!in_array($t2,$partent_fault_id)){
|
|
|
|
- $xianxian_score = 1+$xianxian_score;
|
|
|
|
- $xianxian_content[] = [
|
|
|
|
- 'cx_id'=>$t2,
|
|
|
|
- 'cx_type'=>'错写',
|
|
|
|
- 'cx_name'=>Fault::where(['fault_id'=>$t2])->value('name'),
|
|
|
|
- ];
|
|
|
|
- $xianxian_score = 1+$xianxian_score;
|
|
|
|
-// echo "多写:".$t2."@@@@".$xianxian_score."<br/>";
|
|
|
|
- $xianxian_content[] = [
|
|
|
|
- 'cx_id'=>$t2,
|
|
|
|
- 'cx_type'=>'多写',
|
|
|
|
- 'cx_name'=>Fault::where(['fault_id'=>$t2])->value('name'),
|
|
|
|
- ];
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if($xxValue_count!=$issetValue_count){
|
|
|
|
|
|
+
|
|
|
|
+ //故障现象 分数 start
|
|
|
|
+ foreach ($partent_fault_id as $k1 =>$t){
|
|
|
|
+ if(!in_array($t,$xianxian_arr)){
|
|
$xianxian_score = 1+$xianxian_score;
|
|
$xianxian_score = 1+$xianxian_score;
|
|
$xianxian_content[] = [
|
|
$xianxian_content[] = [
|
|
- 'cx_id'=>$xxValue,
|
|
|
|
- 'cx_type'=>'错写',
|
|
|
|
- 'cx_name'=>Fault::where(['fault_id'=>$xxValue])->value('name'),
|
|
|
|
|
|
+ 'cx_id'=>$t,
|
|
|
|
+ 'cx_type'=>'少写',
|
|
|
|
+ 'cx_name'=>Fault::where(['fault_id'=>$t])->value('name'),
|
|
];
|
|
];
|
|
- //多写
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ foreach ($xianxian_arr as $k2 =>$t2){
|
|
|
|
+ if(!in_array($t2,$partent_fault_id)){
|
|
$xianxian_score = 1+$xianxian_score;
|
|
$xianxian_score = 1+$xianxian_score;
|
|
$xianxian_content[] = [
|
|
$xianxian_content[] = [
|
|
- 'cx_id'=>$xxValue,
|
|
|
|
- 'cx_type'=>'多写',
|
|
|
|
- 'cx_name'=>Fault::where(['fault_id'=>$xxValue])->value('name'),
|
|
|
|
|
|
+ 'cx_id'=>$t2,
|
|
|
|
+ 'cx_type'=>'错写',
|
|
|
|
+ 'cx_name'=>Fault::where(['fault_id'=>$t2])->value('name'),
|
|
];
|
|
];
|
|
-// echo "多写:".$xxValue."####".$xianxian_score."<br/>";
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //故障现象 end
|
|
|
|
+
|
|
|
|
|
|
//故障部位 start
|
|
//故障部位 start
|
|
foreach ($fault_arr as $k11 =>$t11){
|
|
foreach ($fault_arr as $k11 =>$t11){
|
|
@@ -384,16 +311,10 @@ class Collection extends Backend
|
|
'cx_type'=>'错写',
|
|
'cx_type'=>'错写',
|
|
'cx_name'=>Fault::where(['fault_id'=>$t12])->value('name'),
|
|
'cx_name'=>Fault::where(['fault_id'=>$t12])->value('name'),
|
|
];
|
|
];
|
|
- //多写
|
|
|
|
- $buwei_score = 1+$buwei_score;
|
|
|
|
- $buwei_content[] = [
|
|
|
|
- 'cx_id'=>$t12,
|
|
|
|
- 'cx_type'=>'多写',
|
|
|
|
- 'cx_name'=>Fault::where(['fault_id'=>$t12])->value('name'),
|
|
|
|
- ];
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//故障部位 end
|
|
//故障部位 end
|
|
|
|
+
|
|
|
|
|
|
//排除方法 start
|
|
//排除方法 start
|
|
//循环固定的排除方法,匹配作答的排除方法
|
|
//循环固定的排除方法,匹配作答的排除方法
|
|
@@ -416,12 +337,6 @@ class Collection extends Backend
|
|
'cx_type'=>'错写',
|
|
'cx_type'=>'错写',
|
|
'cx_name'=>Fault::where(['fault_id'=>$t22])->value('name'),
|
|
'cx_name'=>Fault::where(['fault_id'=>$t22])->value('name'),
|
|
];
|
|
];
|
|
- $fangfa_score = 1+$fangfa_score;
|
|
|
|
- $fangfa_content[] = [
|
|
|
|
- 'cx_id'=>$t22,
|
|
|
|
- 'cx_type'=>'多写',
|
|
|
|
- 'cx_name'=>Fault::where(['fault_id'=>$t22])->value('name'),
|
|
|
|
- ];
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//排除方法 end
|
|
//排除方法 end
|
|
@@ -447,20 +362,14 @@ class Collection extends Backend
|
|
'cx_type'=>'错写',
|
|
'cx_type'=>'错写',
|
|
'cx_name'=>Fault::where(['fault_id'=>$t32])->value('name'),
|
|
'cx_name'=>Fault::where(['fault_id'=>$t32])->value('name'),
|
|
];
|
|
];
|
|
- $yuanyin_socre = 1+$yuanyin_socre;
|
|
|
|
- $yuanyin_content[] = [
|
|
|
|
- 'cx_id'=>$t32,
|
|
|
|
- 'cx_type'=>'多写',
|
|
|
|
- 'cx_name'=>Fault::where(['fault_id'=>$t32])->value('name'),
|
|
|
|
- ];
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//可能原因 end
|
|
//可能原因 end
|
|
}
|
|
}
|
|
- $weixiu_score = $xianxian_score+$yuanyin_socre+$buwei_score+$fangfa_score;
|
|
|
|
- if($weixiu_score>15){
|
|
|
|
- $weixiu_score = 15;
|
|
|
|
- }
|
|
|
|
|
|
+ $weixiu_score = $xianxian_score+$yuanyin_socre+$buwei_score+$fangfa_score;
|
|
|
|
+ if($weixiu_score>15){
|
|
|
|
+ $weixiu_score = 15;
|
|
|
|
+ }
|
|
|
|
|
|
//是否超时
|
|
//是否超时
|
|
$overtime_fen = intval((time()-$info['endtime']) / 60);
|
|
$overtime_fen = intval((time()-$info['endtime']) / 60);
|
|
@@ -480,15 +389,19 @@ class Collection extends Backend
|
|
$params['fault_two_score'] = $fault_two_score;//得分;
|
|
$params['fault_two_score'] = $fault_two_score;//得分;
|
|
$params['fault_three_score'] = $fault_three_score;//得分;
|
|
$params['fault_three_score'] = $fault_three_score;//得分;
|
|
|
|
|
|
|
|
+
|
|
$params['xianxian_score'] = $xianxian_score;//得分;
|
|
$params['xianxian_score'] = $xianxian_score;//得分;
|
|
$params['xianxian_content'] = json_encode($xianxian_content);//错题;
|
|
$params['xianxian_content'] = json_encode($xianxian_content);//错题;
|
|
-// $params['yuanyin_socre'] = $yuanyin_socre;//得分;
|
|
|
|
-// $params['yuanyin_content'] = !empty($yuanyin_arr) ? json_encode($yuanyin_arr) : '';//错题;
|
|
|
|
|
|
+
|
|
|
|
+ $params['yuanyin_socre'] = $yuanyin_socre;//得分;
|
|
|
|
+ $params['yuanyin_content'] = json_encode($yuanyin_content);//错题;
|
|
|
|
+
|
|
$params['buwei_score'] = $buwei_score;//得分;
|
|
$params['buwei_score'] = $buwei_score;//得分;
|
|
$params['buwei_content'] = json_encode($buwei_content);//错题;
|
|
$params['buwei_content'] = json_encode($buwei_content);//错题;
|
|
-// $params['fangfa_score'] = $fangfa_score;//得分;
|
|
|
|
-// $params['fangfa_content'] = !empty($fangfa_arr) ? json_encode($fangfa_arr):'';//错题;
|
|
|
|
-// $params['jielun_score'] = $jielun_score;//得分;
|
|
|
|
|
|
+
|
|
|
|
+ $params['fangfa_score'] = $fangfa_score;//得分;
|
|
|
|
+ $params['fangfa_content'] = json_encode($fangfa_content);//错题;
|
|
|
|
+
|
|
$params['overtime_score'] = $overtime_score;//得分;
|
|
$params['overtime_score'] = $overtime_score;//得分;
|
|
Db::name('real_exam_score')->insert($params);
|
|
Db::name('real_exam_score')->insert($params);
|
|
|
|
|
|
@@ -618,18 +531,18 @@ class Collection extends Backend
|
|
if(!empty($unwin)){
|
|
if(!empty($unwin)){
|
|
$xx_name = Fault::where('fault_id',$unwin['xx_id'])->value('name');
|
|
$xx_name = Fault::where('fault_id',$unwin['xx_id'])->value('name');
|
|
$yy_name = Fault::where('fault_id','in',$unwin['yy_id'])->column('name');
|
|
$yy_name = Fault::where('fault_id','in',$unwin['yy_id'])->column('name');
|
|
- $bw_name = Fault::where('fault_id','in',$unwin['bw_id'])->column('name');
|
|
|
|
- $pc_name = Fault::where('fault_id','in',$unwin['pc_id'])->column('name');
|
|
|
|
|
|
+ $bw_name = Fault::where('fault_id',$unwin['bw_id'])->value('name');
|
|
|
|
+ $pc_name = Fault::where('fault_id',$unwin['pc_id'])->value('name');
|
|
$arr = [
|
|
$arr = [
|
|
'xh_id' => $unwin['xh_id'],
|
|
'xh_id' => $unwin['xh_id'],
|
|
'xx_id' => $unwin['xx_id'],
|
|
'xx_id' => $unwin['xx_id'],
|
|
'xx_name'=>$xx_name,
|
|
'xx_name'=>$xx_name,
|
|
'yy_id' => implode(',',$unwin['yy_id']),
|
|
'yy_id' => implode(',',$unwin['yy_id']),
|
|
'yy_name' => implode(',',$yy_name),
|
|
'yy_name' => implode(',',$yy_name),
|
|
- 'bw_id' => implode(',',$unwin['bw_id']),
|
|
|
|
- 'bw_name' => implode(',',$bw_name),
|
|
|
|
- 'pc_id' => implode(',',$unwin['pc_id']),
|
|
|
|
- 'pc_name' => implode(',',$pc_name),
|
|
|
|
|
|
+ 'bw_id' => $unwin['bw_id'],
|
|
|
|
+ 'bw_name' => $bw_name,
|
|
|
|
+ 'pc_id' => $unwin['pc_id'],
|
|
|
|
+ 'pc_name' => $pc_name,
|
|
];
|
|
];
|
|
}
|
|
}
|
|
$other_report = !empty($row->other_report) ? json_decode($row->other_report,true) : [];
|
|
$other_report = !empty($row->other_report) ? json_decode($row->other_report,true) : [];
|
|
@@ -653,10 +566,15 @@ class Collection extends Backend
|
|
$this->view->assign('paichu', $paichu);
|
|
$this->view->assign('paichu', $paichu);
|
|
|
|
|
|
$row->other_report_count = 0;
|
|
$row->other_report_count = 0;
|
|
|
|
+ $xxid = [];
|
|
if(!empty($row->other_report)){
|
|
if(!empty($row->other_report)){
|
|
$row->other_report_count = count(json_decode($row->other_report,true));
|
|
$row->other_report_count = count(json_decode($row->other_report,true));
|
|
|
|
+ $otherreport = json_decode($row->other_report,true);
|
|
|
|
+ foreach ($otherreport as $k =>$item){
|
|
|
|
+ array_push($xxid,$item['xx_id']);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ $row->xxid = $xxid;
|
|
$this->view->assign('row', $row);
|
|
$this->view->assign('row', $row);
|
|
return $this->view->fetch();
|
|
return $this->view->fetch();
|
|
}
|
|
}
|
|
@@ -677,8 +595,8 @@ class Collection extends Backend
|
|
if(!empty($unwin)){
|
|
if(!empty($unwin)){
|
|
$xx_name = Fault::where('fault_id',$unwin['xx_id'])->value('name');
|
|
$xx_name = Fault::where('fault_id',$unwin['xx_id'])->value('name');
|
|
$yy_name = Fault::where('fault_id','in',$unwin['yy_id'])->column('name');
|
|
$yy_name = Fault::where('fault_id','in',$unwin['yy_id'])->column('name');
|
|
- $bw_name = Fault::where('fault_id','in',$unwin['bw_id'])->column('name');
|
|
|
|
- $pc_name = Fault::where('fault_id','in',$unwin['pc_id'])->column('name');
|
|
|
|
|
|
+ $bw_name = Fault::where('fault_id',$unwin['bw_id'])->value('name');
|
|
|
|
+ $pc_name = Fault::where('fault_id',$unwin['pc_id'])->value('name');
|
|
$other_report = !empty($row->other_report) ? json_decode($row->other_report,true) : [];
|
|
$other_report = !empty($row->other_report) ? json_decode($row->other_report,true) : [];
|
|
foreach ($other_report as $k =>$item){
|
|
foreach ($other_report as $k =>$item){
|
|
if($k==$xh_id){
|
|
if($k==$xh_id){
|
|
@@ -686,10 +604,10 @@ class Collection extends Backend
|
|
$other_report[$k]['xx_name'] =$xx_name;
|
|
$other_report[$k]['xx_name'] =$xx_name;
|
|
$other_report[$k]['yy_id'] = implode(',',$unwin['yy_id']);
|
|
$other_report[$k]['yy_id'] = implode(',',$unwin['yy_id']);
|
|
$other_report[$k]['yy_name'] =implode(',',$yy_name);
|
|
$other_report[$k]['yy_name'] =implode(',',$yy_name);
|
|
- $other_report[$k]['bw_id'] = implode(',',$unwin['bw_id']);
|
|
|
|
- $other_report[$k]['bw_name'] =implode(',',$bw_name);
|
|
|
|
- $other_report[$k]['pc_id'] =implode(',',$unwin['pc_id']);
|
|
|
|
- $other_report[$k]['pc_name'] =implode(',',$pc_name);
|
|
|
|
|
|
+ $other_report[$k]['bw_id'] = $unwin['bw_id'];
|
|
|
|
+ $other_report[$k]['bw_name'] =$bw_name;
|
|
|
|
+ $other_report[$k]['pc_id'] =$unwin['pc_id'];
|
|
|
|
+ $other_report[$k]['pc_name'] =$pc_name;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$row->other_report = json_encode($other_report);
|
|
$row->other_report = json_encode($other_report);
|
|
@@ -719,8 +637,8 @@ class Collection extends Backend
|
|
$row->other_report_text = [
|
|
$row->other_report_text = [
|
|
'xx_id'=>$item['xx_id'],
|
|
'xx_id'=>$item['xx_id'],
|
|
'yy_id'=>explode(',',$item['yy_id']),
|
|
'yy_id'=>explode(',',$item['yy_id']),
|
|
- 'bw_id'=>explode(',',$item['bw_id']),
|
|
|
|
- 'pc_id'=>explode(',',$item['pc_id']),
|
|
|
|
|
|
+ 'bw_id'=>$item['bw_id'],
|
|
|
|
+ 'pc_id'=>$item['pc_id'],
|
|
'xh_id'=>$item['xh_id']
|
|
'xh_id'=>$item['xh_id']
|
|
];
|
|
];
|
|
}
|
|
}
|