|
@@ -182,21 +182,28 @@ class Collection extends Backend
|
|
$fault_two_score = 25;
|
|
$fault_two_score = 25;
|
|
$fault_three_score = 25;
|
|
$fault_three_score = 25;
|
|
|
|
|
|
|
|
+ //故障现象
|
|
$xianxian_score = 0;
|
|
$xianxian_score = 0;
|
|
- $yuanyin_socre= 0;
|
|
|
|
|
|
+ $xianxian_arr = [];
|
|
|
|
+ $xianxian_content = [];
|
|
|
|
+
|
|
|
|
+ //故障部位
|
|
$buwei_score= 0;
|
|
$buwei_score= 0;
|
|
- $fangfa_score= 0;
|
|
|
|
|
|
+ $buwei_arr = [];
|
|
|
|
+ $buwei_content = [];
|
|
|
|
|
|
- $xianxian_arr = [];
|
|
|
|
|
|
+ //可能原因
|
|
|
|
+ $yuanyin_socre= 0;
|
|
$yuanyin_arr = [];
|
|
$yuanyin_arr = [];
|
|
- $buwei_arr = [];
|
|
|
|
- $fangfa_arr = [];
|
|
|
|
- $jielun_score = 0;
|
|
|
|
|
|
+ $yuanyin_content = [];
|
|
|
|
|
|
|
|
+ //排除方法
|
|
|
|
+ $fangfa_score= 0;
|
|
|
|
+ $fangfa_arr = [];
|
|
|
|
+ $fangfa_content = [];
|
|
|
|
|
|
Db::startTrans();
|
|
Db::startTrans();
|
|
try {
|
|
try {
|
|
-
|
|
|
|
//更新考试结束时间
|
|
//更新考试结束时间
|
|
$row->end_time = date('Y-m-d H:i:s');
|
|
$row->end_time = date('Y-m-d H:i:s');
|
|
$row->endtime = time();
|
|
$row->endtime = time();
|
|
@@ -206,7 +213,6 @@ class Collection extends Backend
|
|
|
|
|
|
$info = $this->exam_model->where(['exam_id'=>$ids])->find();
|
|
$info = $this->exam_model->where(['exam_id'=>$ids])->find();
|
|
|
|
|
|
-
|
|
|
|
//更新故障是否正确
|
|
//更新故障是否正确
|
|
$fault_list = Db::name('real_exam_fault')->where(['exam_id'=>$ids,'flag'=>1])->select();
|
|
$fault_list = Db::name('real_exam_fault')->where(['exam_id'=>$ids,'flag'=>1])->select();
|
|
if(!empty($fault_list)){
|
|
if(!empty($fault_list)){
|
|
@@ -225,7 +231,6 @@ class Collection extends Backend
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
//计算得分,故障是否有扣分 扣分制
|
|
//计算得分,故障是否有扣分 扣分制
|
|
$fault_right_list = Db::name('real_exam_fault')->where(['exam_id'=>$ids,'flag'=>1,'answer_right'=>['>',0]])->select();
|
|
$fault_right_list = Db::name('real_exam_fault')->where(['exam_id'=>$ids,'flag'=>1,'answer_right'=>['>',0]])->select();
|
|
if(!empty($fault_right_list)){
|
|
if(!empty($fault_right_list)){
|
|
@@ -239,74 +244,204 @@ class Collection extends Backend
|
|
$fault_three_score = 0;
|
|
$fault_three_score = 0;
|
|
}
|
|
}
|
|
|
|
|
|
- //根据故障部位,查找故障现象
|
|
|
|
|
|
+ //根据故障部位 数组
|
|
$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']];
|
|
|
|
+ //查找故障现象 数组
|
|
$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');
|
|
|
|
|
|
- //故障保存的是部位,需要查找故障现象
|
|
|
|
- $other_report = json_decode($params['other_report'],true);
|
|
|
|
- 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;
|
|
|
|
|
|
+ $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;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- foreach ($other_report as $key => $em){
|
|
|
|
- //故障现象
|
|
|
|
- if(!in_array($em['xx_id'],$partent_fault_id)){
|
|
|
|
- $xianxian_score = 5+$xianxian_score;
|
|
|
|
|
|
+ $other_report = json_decode($params['other_report'],true);
|
|
|
|
+ if(!empty($other_report)){
|
|
|
|
+ foreach ($other_report as $key => $em){
|
|
|
|
+ //故障现象
|
|
$xianxian_arr[] = $em['xx_id'];
|
|
$xianxian_arr[] = $em['xx_id'];
|
|
|
|
+
|
|
|
|
+ //故障部位
|
|
|
|
+ $buwei_arr[] = $em['bw_id'];
|
|
}
|
|
}
|
|
|
|
+ //可能原因
|
|
|
|
+ //排除方法
|
|
|
|
+ }
|
|
|
|
+ echo "<pre>";
|
|
|
|
+ print_r($fault_arr);
|
|
|
|
+ echo "<pre>";
|
|
|
|
+ print_r($buwei_arr);
|
|
|
|
+
|
|
|
|
+ $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(!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;
|
|
|
|
- }
|
|
|
|
|
|
+ //故障现象 判断数量是否一致,
|
|
|
|
+ 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/>";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
- //部位为空 +1
|
|
|
|
- $buwei_score = 1+ $buwei_score;
|
|
|
|
|
|
+ foreach ($xianxian_arr as $k2 =>$t2){
|
|
|
|
+ if(!in_array($t2,$partent_fault_id)){
|
|
|
|
+ //多写
|
|
|
|
+ $xianxian_score = 1+$xianxian_score;
|
|
|
|
+ echo "多写:".$t2."@@@@".$xianxian_score."<br/>";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ 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,
|
|
|
|
+ '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){
|
|
|
|
+ //错写
|
|
|
|
+ $xianxian_score = 1+$xianxian_score;
|
|
|
|
+ $xianxian_content[] = [
|
|
|
|
+ 'cx_id'=>$xxValue,
|
|
|
|
+ 'cx_type'=>'错写',
|
|
|
|
+ 'cx_name'=>Fault::where(['fault_id'=>$xxValue])->value('name'),
|
|
|
|
+ ];
|
|
|
|
+ //多写
|
|
|
|
+ $xianxian_score = 1+$xianxian_score;
|
|
|
|
+ $xianxian_content[] = [
|
|
|
|
+ 'cx_id'=>$xxValue,
|
|
|
|
+ 'cx_type'=>'多写',
|
|
|
|
+ 'cx_name'=>Fault::where(['fault_id'=>$xxValue])->value('name'),
|
|
|
|
+ ];
|
|
|
|
+// echo "多写:".$xxValue."####".$xianxian_score."<br/>";
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
- //可能原因
|
|
|
|
- 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{
|
|
|
|
|
|
+ //故障部位 数量不相同
|
|
|
|
+ if(count($fault_arr)!=count($buwei_arr)){
|
|
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- //部位为空 +1
|
|
|
|
- $yuanyin_socre = 1+$yuanyin_socre;
|
|
|
|
- }
|
|
|
|
|
|
+ }else{ //数量相同
|
|
|
|
+ halt('数量相同');
|
|
|
|
+ }
|
|
|
|
|
|
- //排除方法
|
|
|
|
- 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;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+// 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;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+
|
|
}
|
|
}
|
|
// echo "<pre>";
|
|
// echo "<pre>";
|
|
// print_r($buwei_arr);
|
|
// print_r($buwei_arr);
|
|
@@ -318,13 +453,7 @@ class Collection extends Backend
|
|
if($weixiu_score>15){
|
|
if($weixiu_score>15){
|
|
$weixiu_score = 15;
|
|
$weixiu_score = 15;
|
|
}
|
|
}
|
|
-// $xianxian_score = rand(1,3);
|
|
|
|
-// $yuanyin_socre= rand(1,3);
|
|
|
|
-// $buwei_score= rand(1,3);
|
|
|
|
-// $fangfa_score= rand(1,3);
|
|
|
|
-// if(empty($params['other_jielun'])){
|
|
|
|
-// $jielun_score = rand(1,3);
|
|
|
|
-// }
|
|
|
|
|
|
+
|
|
//是否超时
|
|
//是否超时
|
|
$overtime_fen = intval((time()-$info['endtime']) / 60);
|
|
$overtime_fen = intval((time()-$info['endtime']) / 60);
|
|
if($overtime_fen>=10){
|
|
if($overtime_fen>=10){
|
|
@@ -344,13 +473,13 @@ class Collection extends Backend
|
|
$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'] = !empty($xianxian_arr) ? json_encode($xianxian_arr):'';//错题;
|
|
|
|
- $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['fangfa_score'] = $fangfa_score;//得分;
|
|
|
|
- $params['fangfa_content'] = !empty($fangfa_arr) ? json_encode($fangfa_arr):'';//错题;
|
|
|
|
|
|
+ $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['fangfa_score'] = $fangfa_score;//得分;
|
|
|
|
+// $params['fangfa_content'] = !empty($fangfa_arr) ? json_encode($fangfa_arr):'';//错题;
|
|
// $params['jielun_score'] = $jielun_score;//得分;
|
|
// $params['jielun_score'] = $jielun_score;//得分;
|
|
$params['overtime_score'] = $overtime_score;//得分;
|
|
$params['overtime_score'] = $overtime_score;//得分;
|
|
Db::name('real_exam_score')->insert($params);
|
|
Db::name('real_exam_score')->insert($params);
|
|
@@ -367,7 +496,6 @@ class Collection extends Backend
|
|
}
|
|
}
|
|
$this->success('交卷成功,待老师确认成绩','/ZQOtIMLKud.php/student/exam/index');
|
|
$this->success('交卷成功,待老师确认成绩','/ZQOtIMLKud.php/student/exam/index');
|
|
}
|
|
}
|
|
-
|
|
|
|
if(empty($row->starttime)){
|
|
if(empty($row->starttime)){
|
|
$row->start_time = date('Y-m-d H:i:s');
|
|
$row->start_time = date('Y-m-d H:i:s');
|
|
$row->starttime = time();
|
|
$row->starttime = time();
|
|
@@ -381,6 +509,7 @@ class Collection extends Backend
|
|
}
|
|
}
|
|
$row->other_report_text = !empty($row->other_report) ? json_decode($row->other_report,true) : [];
|
|
$row->other_report_text = !empty($row->other_report) ? json_decode($row->other_report,true) : [];
|
|
|
|
|
|
|
|
+ $other_report_count = !empty($row->other_report) ? count(json_decode($row->other_report,true)) :0;
|
|
//还未开始考试
|
|
//还未开始考试
|
|
$row->limit_duration = $this->model->where(['exam_collection_id'=>$row['exam_collection_id']])->value('limit_duration');
|
|
$row->limit_duration = $this->model->where(['exam_collection_id'=>$row['exam_collection_id']])->value('limit_duration');
|
|
if(empty($row->starttime)){
|
|
if(empty($row->starttime)){
|
|
@@ -393,6 +522,7 @@ class Collection extends Backend
|
|
$this->assignConfig('ids',$ids);
|
|
$this->assignConfig('ids',$ids);
|
|
$this->assignConfig('timer',$timer);
|
|
$this->assignConfig('timer',$timer);
|
|
$this->assignConfig('isloading',$isloading);
|
|
$this->assignConfig('isloading',$isloading);
|
|
|
|
+ $this->assignConfig('other_report_count',$other_report_count);
|
|
$this->view->assign('row', $row);
|
|
$this->view->assign('row', $row);
|
|
|
|
|
|
$departmentdata = [];
|
|
$departmentdata = [];
|