|
@@ -118,7 +118,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)){
|
|
|
- if($info['seat_id']>0 && $this->auth->seat_id!=$info['seat_id']){
|
|
|
+ if(!empty($this->auth->seat_id) && !empty($info['seat_id']) && $this->auth->seat_id!=$info['seat_id']){
|
|
|
$this->error('已在其他座号有开始的考试,不允许换座号');
|
|
|
}
|
|
|
$this->exam_model->where('exam_id',$info['exam_id'])->update(['seat_id'=>$this->auth->seat_id]);
|
|
@@ -165,14 +165,12 @@ class Collection extends Backend
|
|
|
//先请求接口判断,再进行处理
|
|
|
if(Env::get('app.is_fault')){
|
|
|
$url = config('site.url_type').'/sim/real-exam/student/exam/submit/'.$ids;
|
|
|
- // /dev-api/sim/real-exam/student/exam/submit/{examId}
|
|
|
$ret = json_decode(send_get($url),true);
|
|
|
// halt($ret);
|
|
|
if($ret['code']!=200){
|
|
|
$this->error($ret['msg']);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
//计算分数,保存记录
|
|
|
$params = $this->request->post('row/a');
|
|
|
|
|
@@ -246,6 +244,10 @@ class Collection extends Backend
|
|
|
|
|
|
//根据故障部位 数组
|
|
|
$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');
|
|
|
+ //根据故障部位查找,匹配可能原因
|
|
|
+ $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');
|
|
|
|
|
@@ -259,23 +261,19 @@ class Collection extends Backend
|
|
|
$issetValue_count = $count;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
$other_report = json_decode($params['other_report'],true);
|
|
|
if(!empty($other_report)){
|
|
|
foreach ($other_report as $key => $em){
|
|
|
//故障现象
|
|
|
$xianxian_arr[] = $em['xx_id'];
|
|
|
-
|
|
|
//故障部位
|
|
|
$buwei_arr[] = $em['bw_id'];
|
|
|
+ //可能原因
|
|
|
+ $yuanyin_arr[] = $em['yy_id'];
|
|
|
+ //排除方法
|
|
|
+ $fangfa_arr[] = $em['pc_id'];
|
|
|
}
|
|
|
- //可能原因
|
|
|
- //排除方法
|
|
|
}
|
|
|
- echo "<pre>";
|
|
|
- print_r($fault_arr);
|
|
|
- echo "<pre>";
|
|
|
- print_r($buwei_arr);
|
|
|
|
|
|
$xxValue = '';
|
|
|
$xxValue_count = 0;
|
|
@@ -287,41 +285,42 @@ class Collection extends Backend
|
|
|
$xxValue_count = $t;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
//故障现象 判断数量是否一致,
|
|
|
if(count($partent_fault_id)!=count($xianxian_arr)){
|
|
|
- //少写
|
|
|
- $xianxian_arr_count = count($xianxian_arr) ;
|
|
|
- $xianxian_score = (3-1*$xianxian_arr_count)+$xianxian_score;
|
|
|
- //计算故障现象分数
|
|
|
- if($xianxian_arr_count==1){
|
|
|
- $count = count(array_keys($partent_fault_id, $xianxian_arr[0])); // 更准确的方法是使用下面
|
|
|
- $xianxian_score = $count>1? 1*$count+$xianxian_score:(3-1*$count)+$xianxian_score;
|
|
|
- }
|
|
|
- if($xianxian_arr_count==2){
|
|
|
- foreach ($partent_fault_id as $k1 =>$t){
|
|
|
- if(!in_array($t,$xianxian_arr)){
|
|
|
- //错写
|
|
|
- $xianxian_score = 1+$xianxian_score;
|
|
|
- echo "错写:".$t."@@@@".$xianxian_score."<br/>";
|
|
|
- }
|
|
|
+ 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 $k2 =>$t2){
|
|
|
- if(!in_array($t2,$partent_fault_id)){
|
|
|
- //多写
|
|
|
- $xianxian_score = 1+$xianxian_score;
|
|
|
- echo "多写:".$t2."@@@@".$xianxian_score."<br/>";
|
|
|
- }
|
|
|
+ }
|
|
|
+ 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'),
|
|
|
+ ];
|
|
|
}
|
|
|
}
|
|
|
- echo "<pre>";
|
|
|
- echo $xianxian_score;
|
|
|
- die('asdfasdf');
|
|
|
}else{ //数量相同
|
|
|
//计算故障现象分数
|
|
|
foreach ($partent_fault_id as $k1 =>$t){
|
|
|
if(!in_array($t,$xianxian_arr)){
|
|
|
- //少写
|
|
|
$xianxian_score = 1+$xianxian_score;
|
|
|
$xianxian_content[] = [
|
|
|
'cx_id'=>$t,
|
|
@@ -332,14 +331,12 @@ class Collection extends Backend
|
|
|
}
|
|
|
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[] = [
|
|
@@ -350,7 +347,6 @@ class Collection extends Backend
|
|
|
}
|
|
|
}
|
|
|
if($xxValue_count!=$issetValue_count){
|
|
|
- //错写
|
|
|
$xianxian_score = 1+$xianxian_score;
|
|
|
$xianxian_content[] = [
|
|
|
'cx_id'=>$xxValue,
|
|
@@ -368,87 +364,99 @@ class Collection extends Backend
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- //故障部位 数量不相同
|
|
|
- if(count($fault_arr)!=count($buwei_arr)){
|
|
|
-
|
|
|
- }else{ //数量相同
|
|
|
- halt('数量相同');
|
|
|
+ //故障部位 start
|
|
|
+ foreach ($fault_arr as $k11 =>$t11){
|
|
|
+ if(!in_array($t11,$buwei_arr)){
|
|
|
+ $buwei_score = 1+$buwei_score;
|
|
|
+ $buwei_content[] = [
|
|
|
+ 'cx_id'=>$t11,
|
|
|
+ 'cx_type'=>'少写',
|
|
|
+ 'cx_name'=>Fault::where(['fault_id'=>$t11])->value('name'),
|
|
|
+ ];
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-// echo "<pre>";
|
|
|
-// echo $xianxian_score;
|
|
|
-// die();
|
|
|
-// if(count($other_report)<3){
|
|
|
-// $xianxian_score = 15-5*count($other_report)+$xianxian_score;
|
|
|
-// $buwei_score = 3-1*count($other_report)+$buwei_score;
|
|
|
-// $yuanyin_socre = 3-1*count($other_report)+$yuanyin_socre;
|
|
|
-// $fangfa_score = 3-1*count($other_report)+$fangfa_score;
|
|
|
-// }
|
|
|
-// 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'];
|
|
|
-// }
|
|
|
-//
|
|
|
-// //故障部位
|
|
|
-// if(!empty($em['bw_id'])){
|
|
|
-// $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;
|
|
|
-// $buwei_arr[] = $em['bw_id'];
|
|
|
-// }else{
|
|
|
-// //现象正确,判断是不是正确的选项
|
|
|
-// foreach (explode(',',$em['bw_id']) as $s => $bs){
|
|
|
-// if(!in_array($bs,$fault_arr)){
|
|
|
-// $buwei_score = 1+$buwei_score;
|
|
|
-// $buwei_arr[] = $bs;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }else{
|
|
|
-// //部位为空 +1
|
|
|
-// $buwei_score = 1+ $buwei_score;
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// //可能原因
|
|
|
-// if(!empty($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{
|
|
|
-//
|
|
|
-// }
|
|
|
-// }else{
|
|
|
-// //部位为空 +1
|
|
|
-// $yuanyin_socre = 1+$yuanyin_socre;
|
|
|
-// }
|
|
|
-//
|
|
|
-// //排除方法
|
|
|
-// if(!empty($em['pc_id'])){
|
|
|
-// $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'];
|
|
|
-// }else{
|
|
|
-//
|
|
|
-// }
|
|
|
-// }else{
|
|
|
-// $fangfa_score = 1+$fangfa_score;
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
+ foreach ($buwei_arr as $k12 =>$t12){
|
|
|
+ if(!empty($t12) && !in_array($t12,$fault_arr)){
|
|
|
+ //错写
|
|
|
+ $buwei_score = 1+$buwei_score;
|
|
|
+ $buwei_content[] = [
|
|
|
+ 'cx_id'=>$t12,
|
|
|
+ 'cx_type'=>'错写',
|
|
|
+ '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
|
|
|
+
|
|
|
+ //排除方法 start
|
|
|
+ //循环固定的排除方法,匹配作答的排除方法
|
|
|
+ foreach ($paichu_arr as $k21 =>$t21){
|
|
|
+ if(!in_array($t21,$fangfa_arr)){
|
|
|
+ $fangfa_score = 1+$fangfa_score;
|
|
|
+ $fangfa_content[] = [
|
|
|
+ 'cx_id'=>$t21,
|
|
|
+ 'cx_type'=>'少写',
|
|
|
+ 'cx_name'=>Fault::where(['fault_id'=>$t21])->value('name'),
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //循环作答的排除方法,,匹配固定的排除方法
|
|
|
+ foreach ($fangfa_arr as $k22 =>$t22){
|
|
|
+ if(!empty($t22) && !in_array($t22,$paichu_arr)){
|
|
|
+ $fangfa_score = 1+$fangfa_score;
|
|
|
+ $fangfa_content[] = [
|
|
|
+ 'cx_id'=>$t22,
|
|
|
+ 'cx_type'=>'错写',
|
|
|
+ '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
|
|
|
+
|
|
|
+ //可能原因 start
|
|
|
+ //循环固定的可能原因,匹配作答的可能原因
|
|
|
+ foreach ($yy_arr as $k31 =>$t31){
|
|
|
+ if(!in_array($t31,$yuanyin_arr)){
|
|
|
+ $yuanyin_socre = 1+$yuanyin_socre;
|
|
|
+ $yuanyin_content[] = [
|
|
|
+ 'cx_id'=>$t31,
|
|
|
+ 'cx_type'=>'少写',
|
|
|
+ 'cx_name'=>Fault::where(['fault_id'=>$t31])->value('name'),
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //循环作答的排除方法,,匹配固定的排除方法
|
|
|
+ foreach ($yuanyin_arr as $k32 =>$t32){
|
|
|
+ if(!empty($t32) && !in_array($t32,$yy_arr)){
|
|
|
+ $yuanyin_socre = 1+$yuanyin_socre;
|
|
|
+ $yuanyin_content[] = [
|
|
|
+ 'cx_id'=>$t32,
|
|
|
+ 'cx_type'=>'错写',
|
|
|
+ '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
|
|
|
}
|
|
|
-// 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;
|
|
|
if($weixiu_score>15){
|
|
|
$weixiu_score = 15;
|
|
@@ -476,8 +484,8 @@ class Collection extends Backend
|
|
|
$params['xianxian_content'] = json_encode($xianxian_content);//错题;
|
|
|
// $params['yuanyin_socre'] = $yuanyin_socre;//得分;
|
|
|
// $params['yuanyin_content'] = !empty($yuanyin_arr) ? json_encode($yuanyin_arr) : '';//错题;
|
|
|
-// $params['buwei_score'] = $buwei_score;//得分;
|
|
|
-// $params['buwei_content'] = !empty($buwei_arr) ? json_encode($buwei_arr) :'';//错题;
|
|
|
+ $params['buwei_score'] = $buwei_score;//得分;
|
|
|
+ $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;//得分;
|