Exercise.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <?php
  2. namespace app\admin\controller\student;
  3. use app\admin\model\department\Department;
  4. use app\admin\model\Fault;
  5. use app\admin\model\Report;
  6. use app\common\controller\Backend;
  7. use app\common\model\Config as ConfigModel;
  8. use think\Db;
  9. use think\Env;
  10. use think\exception\PDOException;
  11. use think\exception\ValidateException;
  12. /**
  13. * sim-自主练习集合管理
  14. *
  15. * @icon fa fa-circle-o
  16. */
  17. class Exercise extends Backend
  18. {
  19. /**
  20. * Collection模型对象
  21. * @var \app\admin\model\teacher\Collection
  22. */
  23. protected $model = null;
  24. protected $exam_model = null;
  25. protected $whereExtend = null;
  26. public function _initialize()
  27. {
  28. parent::_initialize();
  29. $this->model = new \app\admin\model\teacher\Collection;
  30. $this->exam_model = new \app\admin\model\teacher\Exams;
  31. $this->assign('sim_sim_type', ConfigModel::getSimTypeList());
  32. }
  33. /**
  34. * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
  35. * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
  36. * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
  37. */
  38. public function index()
  39. {
  40. //设置过滤方法
  41. $this->request->filter(['strip_tags', 'trim']);
  42. if (false === $this->request->isAjax()) {
  43. return $this->view->fetch();
  44. }
  45. if ($this->request->isPost()) {
  46. $params = $this->request->post('row/a');
  47. $count = 0;
  48. Db::startTrans();
  49. try {
  50. $params['exam_collection_type'] = 2;
  51. $params['exam_collection_state'] = 2;
  52. $params['question_setting_method'] = 1;
  53. $params['exam_collection_name'] = $this->auth->nickname.'自主练习';
  54. $params['limit_duration'] = 30;
  55. $params['start_time'] = date('Y-m-d');
  56. $params['end_time'] = date('Y-m-d');
  57. $exam_id = $this->model->insertGetId($params);
  58. $sim = Db::name('sim')->where('sim_type',$params['sim_type'])->where('seat_id',$this->auth->seat_id)->find();
  59. if(empty($sim)){
  60. $this->error('未找到模拟器,不可练习');
  61. }
  62. $data = [
  63. 'exam_collection_id' => $exam_id,
  64. 'user_id' => $this->auth->id,
  65. 'user_username' => $this->auth->username,
  66. 'user_nickname' => $this->auth->nickname,
  67. 'user_depart_id' => $this->auth->depart_id,
  68. 'exam_collection_name' => $params['exam_collection_name'],
  69. 'exam_collection_type' =>$params['exam_collection_type'],
  70. 'sim_type' => $params['sim_type'],
  71. 'seat_id' =>$this->auth->seat_id,
  72. 'sim_id' =>$sim['sim_id'],
  73. 'exam_status'=>4,
  74. 'start_time'=>date('Y-m-d H:i:s'),
  75. 'starttime'=>time(),
  76. 'create_time'=>date('Y-m-d H:i:s'),
  77. 'createtime'=>time(),
  78. 'update_time'=>date('Y-m-d H:i:s'),
  79. 'updatetime'=>time(),
  80. ];
  81. $examid = $this->exam_model->insertGetId($data);
  82. //匹配的学员自动加入 mx_real_exam_fault 考试故障关联表
  83. $fault_list = Fault::where(['sim_type' => $params['sim_type'], 'fault_state' => 0,'fault_type'=>3])->select();
  84. foreach ($fault_list as $key=> $item1){
  85. // $fault_key = [1,5,7];//array_rand($fault_list, 3);
  86. // $fault_key1 = rand(0, 1);
  87. // $fault_key2 = rand(2, 3);
  88. // $fault_key3 = rand(4, 5);
  89. $fault_key = [1,3,5];
  90. $flag = 0;
  91. if(!empty($fault_key) && in_array($key,$fault_key)){
  92. $flag = 1;
  93. }
  94. $add= [
  95. 'exam_id'=>$examid,
  96. 'fault_id'=>$item1['fault_id'],
  97. 'ref_type'=>2,
  98. 'flag'=>$flag,
  99. 'ref_state'=>0,
  100. 'createtime'=>time(),
  101. 'updatetime'=>time(),
  102. 'create_time'=>date('Y-m-d H:i:s'),
  103. 'update_time'=>date('Y-m-d H:i:s'),
  104. ];
  105. Db::name('real_exam_fault')->insert($add);
  106. }
  107. $count = $examid;
  108. Db::commit();
  109. } catch (PDOException|Exception $e) {
  110. Db::rollback();
  111. $this->error($e->getMessage());
  112. }
  113. if ($count) {
  114. $this->success('开始成功','/admin/student/exercise/examing/ids/'.$count);
  115. }
  116. $this->error(__('No rows were updated'));
  117. }
  118. }
  119. public function examing($ids = null)
  120. {
  121. $row = $this->exam_model->get($ids);
  122. if(!$row){
  123. $this->error('未找到记录');
  124. }
  125. //先请求接口判断,再进行处理
  126. if(Env::get('app.is_fault')){
  127. $url = config('site.url_type').'/sim/real-exam/student/self-exercise/start/'.$ids;
  128. $ret = json_decode(send_get($url),true);
  129. if($ret['code']!=200){
  130. $this->error($ret['msg']);
  131. }
  132. }
  133. if ($this->request->isPost()) {
  134. //先请求接口判断,再进行处理
  135. if(Env::get('app.is_fault')){
  136. $url = config('site.url_type').'/sim/real-exam/student/self-exercise/submit/'.$ids;
  137. $ret = json_decode(send_get($url),true);
  138. if($ret['code']!=200){
  139. $this->error($ret['msg']);
  140. }
  141. }
  142. //计算分数,保存记录
  143. $params = $this->request->post('row/a');
  144. $result = false;
  145. $score = 100;
  146. $fault_one_score = 25;
  147. $fault_two_score = 25;
  148. $fault_three_score = 25;
  149. //故障现象
  150. $xianxian_score = 0;
  151. $xianxian_arr = [];
  152. $xianxian_content = [];
  153. //故障部位
  154. $buwei_score= 0;
  155. $buwei_arr = [];
  156. $buwei_content = [];
  157. //可能原因
  158. $yuanyin_socre= 0;
  159. $yuanyin_arr = [];
  160. $yuanyin_content = [];
  161. //排除方法
  162. $fangfa_score= 0;
  163. $fangfa_arr = [];
  164. $fangfa_content = [];
  165. $other_content = [];
  166. $content = [];
  167. Db::startTrans();
  168. try {
  169. if(!empty($params['other_report'])){
  170. //获取数组
  171. $other_report = json_decode($params['other_report'],true);
  172. if(count($other_report)==1){
  173. $other_report[1] = [
  174. 'xh_id' => 1,
  175. 'xx_id' => '',
  176. 'xx_name' => '',
  177. 'yy_id' => '',
  178. 'yy_name' => '',
  179. 'bw_id' => '',
  180. 'bw_name' => '',
  181. 'pc_id' => '',
  182. 'pc_name' => ''
  183. ];
  184. $other_report[2] = [
  185. 'xh_id' => 2,
  186. 'xx_id' => '',
  187. 'xx_name' => '',
  188. 'yy_id' => '',
  189. 'yy_name' => '',
  190. 'bw_id' => '',
  191. 'bw_name' => '',
  192. 'pc_id' => '',
  193. 'pc_name' => ''
  194. ];
  195. }else if(count($other_report)==2){
  196. $other_report[2] = [
  197. 'xh_id' => 2,
  198. 'xx_id' => '',
  199. 'xx_name' => '',
  200. 'yy_id' => '',
  201. 'yy_name' => '',
  202. 'bw_id' => '',
  203. 'bw_name' => '',
  204. 'pc_id' => '',
  205. 'pc_name' => ''
  206. ];
  207. }
  208. $params['other_report'] = json_encode($other_report);
  209. }
  210. //更新考试结束时间
  211. $row->end_time = date('Y-m-d H:i:s');
  212. $row->endtime = time();
  213. $row->exam_status = 5;
  214. $row->other_report = $params['other_report'];
  215. $result = $row->save();
  216. $info = $this->exam_model->where(['exam_id'=>$ids])->find();
  217. //更新故障是否正确
  218. $fault_list = Db::name('real_exam_fault')->where(['exam_id'=>$ids,'flag'=>1])->select();
  219. if(!empty($fault_list)){
  220. foreach ($fault_list as $k =>$t){
  221. $answer_right = 2;
  222. if(!empty($t['sim_fault_question_value']) && !empty($t['sim_fault_answer_value'])){
  223. if($t['sim_fault_question_value']!=$t['sim_fault_answer_value'] ){
  224. //真实故障id 0002GZBW0001 薄膜开关FPC排线
  225. if($t['sim_fault_answer_value']=='00000000' && $t['fault_id'] !='0002GZBW0001'){
  226. $answer_right=2;
  227. }
  228. $answer_right=1;
  229. }
  230. }
  231. Db::name('real_exam_fault')->where(['ref_id'=>$t['ref_id']])->update(['answer_right'=>$answer_right]);
  232. }
  233. }
  234. //计算得分,故障是否有扣分 扣分制
  235. $fault_right_list = Db::name('real_exam_fault')->where(['exam_id'=>$ids,'flag'=>1,'answer_right'=>['>',0]])->select();
  236. if(!empty($fault_right_list)){
  237. if($fault_right_list[0]['answer_right']==1){
  238. $fault_one_score = 0;
  239. }
  240. if($fault_right_list[1]['answer_right']==1){
  241. $fault_two_score = 0;
  242. }
  243. if($fault_right_list[2]['answer_right']==1){
  244. $fault_three_score = 0;
  245. }
  246. }
  247. $fault_right_list = Db::name('real_exam_fault')->where(['exam_id'=>$ids,'flag'=>1])->select();
  248. //根据故障部位,查找故障现象
  249. $fault_arr = [$fault_right_list[0]['fault_id'],$fault_right_list[1]['fault_id'],$fault_right_list[2]['fault_id']];
  250. //根据故障部位查找,匹配的排除方法
  251. $paichu_arr = Report::where(['bw_id'=>['in',$fault_arr],'sim_type'=>$info['sim_type']])->column('pc_id');
  252. // //根据故障部位查找,匹配可能原因
  253. // $yy_arr = Report::where(['bw_id'=>['in',$fault_arr],'sim_type'=>$info['sim_type']])->column('yy_id');
  254. //查找故障现象 数组
  255. $partent_fault_id = Fault::where(['fault_id'=>['in',$fault_arr],'sim_type'=>$info['sim_type']])->column('parent_fault_id');
  256. //根据故障部位查找,匹配可能原因
  257. $yy_arr = Fault::where(['parent_fault_id'=>['in',$partent_fault_id],'sim_type'=>$info['sim_type'],'fault_type'=>2])->column('fault_id');
  258. if(!empty($other_report)){
  259. foreach ($other_report as $k => $v) {
  260. if(!empty($v['xx_id'])){
  261. if(in_array($v['xx_id'],$partent_fault_id)){
  262. //故障现象正确
  263. $kscore = 0;
  264. //故障部位 故障部位错误
  265. $buwei_id= '';
  266. $paichu_id= '';
  267. $yy_id = [];
  268. foreach($fault_arr as $kk1 =>$va1){
  269. $fault_find = Fault::where(['fault_id'=>$va1])->find();
  270. if($fault_find['parent_fault_id']==$v['xx_id']){
  271. $buwei_id = $fault_find['fault_id'];
  272. $paichu_id = $fault_find['ref_type4_fault_id'];
  273. $yy_id = Fault::where(['parent_fault_id'=>$fault_find['parent_fault_id'],'sim_type'=>$info['sim_type'],'fault_type'=>2])->column('fault_id');
  274. }
  275. }
  276. if($v['bw_id']!=$buwei_id){
  277. $buwei_score = 1+$buwei_score;
  278. $kscore = 1+$kscore;
  279. $content[] = [
  280. 'gzxz_id'=>$v['xx_id'],
  281. 'cx_id'=>$v['bw_id'],
  282. 'cx_type'=>'故障部位错写',
  283. 'cx_name'=>Fault::where(['fault_id'=>$v['bw_id']])->value('name'),
  284. ];
  285. }
  286. //故障部位少写
  287. //获取当前的故障部位
  288. if($buwei_id!=$v['bw_id']){
  289. $buwei_score = 1+$buwei_score;
  290. $kscore = 1+$kscore;
  291. $content[] = [
  292. 'gzxz_id'=>$v['xx_id'],
  293. 'cx_id'=>$buwei_id,
  294. 'cx_type'=>'故障部位少写',
  295. 'cx_name'=>Fault::where(['fault_id'=>$buwei_id])->value('name'),
  296. ];
  297. }
  298. //排除方法 错写
  299. if($v['pc_id']!=$paichu_id){
  300. $buwei_score = 1+$buwei_score;
  301. $kscore = 1+$kscore;
  302. $content[] = [
  303. 'gzxz_id'=>$v['xx_id'],
  304. 'cx_id'=>$v['pc_id'],
  305. 'cx_type'=>'排除方法错写',
  306. 'cx_name'=>Fault::where(['fault_id'=>$v['pc_id']])->value('name'),
  307. ];
  308. }
  309. //排放方法 少写
  310. if($paichu_id!=$v['pc_id']){
  311. $fangfa_score = 1+$fangfa_score;
  312. $kscore = 1+$kscore;
  313. $content[] = [
  314. 'gzxz_id'=>$v['xx_id'],
  315. 'cx_id'=>$v['pc_id'],
  316. 'cx_type'=>'排除方法少写',
  317. 'cx_name'=>Fault::where(['fault_id'=>$buwei_id])->value('name'),
  318. ];
  319. }
  320. //可能原因 错写
  321. foreach (explode(',',$v['yy_id']) as $key => $value) {
  322. if(!in_array($value,$yy_id)){
  323. $yuanyin_socre = 1+$yuanyin_socre;
  324. $kscore = 1+$kscore;
  325. $content[] = [
  326. 'gzxz_id'=>$v['xx_id'],
  327. 'cx_id'=>$value,
  328. 'cx_type'=>'可能原因错写',
  329. 'cx_name'=>Fault::where(['fault_id'=>$value])->value('name'),
  330. ];
  331. // echo $v['xx_id']."@@@".$value."@@@".$kscore."<br/>";
  332. }
  333. }
  334. //可能原因 少写
  335. foreach ($yy_id as $key1 => $value1) {
  336. $yy_id_arr = explode(',',$v['yy_id']);
  337. if(!in_array($value1,$yy_id_arr)){
  338. $yuanyin_socre = 1+$yuanyin_socre;
  339. $kscore = 1+$kscore;
  340. $content[] = [
  341. 'gzxz_id'=>$v['xx_id'],
  342. 'cx_id'=>$value1,
  343. 'cx_type'=>'可能原因少写',
  344. 'cx_name'=>Fault::where(['fault_id'=>$value1])->value('name'),
  345. ];
  346. }
  347. }
  348. if($kscore>5){
  349. $kscore = '-5';
  350. }else if($kscore>0){
  351. $kscore = '-'.$kscore;
  352. }else{
  353. $kscore=0;
  354. }
  355. $other_content[$k] = [
  356. 'gzxz_id'=>$v['xx_id'],
  357. 'xh_id' => $k,
  358. 'xx_id' => $v['xx_id'],
  359. 'xx_name' => $v['xx_name'],
  360. 'yy_id' =>$v['yy_id'],
  361. 'yy_name' => $v['yy_name'],
  362. 'bw_id' => $v['bw_id'],
  363. 'bw_name' => $v['bw_name'],
  364. 'pc_id' => $v['pc_id'],
  365. 'pc_name' => $v['pc_name'],
  366. 'cx_type'=>'',
  367. 'cx_name'=>$content,
  368. 'cx_score'=>$kscore,
  369. ];
  370. }else{
  371. $xianxian_score = 5+$xianxian_score;
  372. $other_content[$k] = [
  373. 'gzxz_id'=>$v['xx_id'],
  374. 'xh_id' => $k,
  375. 'xx_id' => $v['xx_id'],
  376. 'xx_name' => $v['xx_name'],
  377. 'yy_id' =>$v['yy_id'],
  378. 'yy_name' => $v['yy_name'],
  379. 'bw_id' => $v['bw_id'],
  380. 'bw_name' => $v['bw_name'],
  381. 'pc_id' => $v['pc_id'],
  382. 'pc_name' => $v['pc_name'],
  383. 'cx_type'=>'故障现象错写',
  384. 'cx_name'=>Fault::where(['fault_id'=>$v['xx_id']])->value('name'),
  385. 'cx_score'=>-5,
  386. ];
  387. }
  388. }else{
  389. $xianxian_score = 5+$xianxian_score;
  390. $other_content[$k] = [
  391. 'gzxz_id'=>'',
  392. 'xh_id' => $k,
  393. 'xx_id' => '',
  394. 'xx_name' => '',
  395. 'yy_id' => '',
  396. 'yy_name' => '',
  397. 'bw_id' => '',
  398. 'bw_name' => '',
  399. 'pc_id' => '',
  400. 'pc_name' => '',
  401. 'cx_type'=>'未作答',
  402. 'cx_name'=>'',
  403. 'cx_score'=>-5,
  404. ];
  405. }
  406. }
  407. }else{
  408. foreach ($partent_fault_id as $key => $em){
  409. $xianxian_score = 5+$xianxian_score;
  410. $other_content[] = [
  411. 'gzxz_id'=>$em,
  412. 'xh_id' => $key,
  413. 'xx_id' => '',
  414. 'xx_name' => '',
  415. 'yy_id' => '',
  416. 'yy_name' => '',
  417. 'bw_id' => '',
  418. 'bw_name' => '',
  419. 'pc_id' => '',
  420. 'pc_name' => '',
  421. 'cx_type'=>'未作答',
  422. 'cx_name'=>'',
  423. 'cx_score'=>-5,
  424. ];
  425. }
  426. unset($em);
  427. }
  428. $weixiu_score = $xianxian_score+$yuanyin_socre+$buwei_score+$fangfa_score;
  429. if($weixiu_score>15){
  430. $weixiu_score = 15;
  431. }
  432. //是否超时
  433. $overtime_fen = intval((time()-$info['countdown_time']) / 60);
  434. if($overtime_fen>=10){
  435. $overtime_score = 10;
  436. }else if($overtime_fen>0 && $overtime_fen<10){
  437. $overtime_score = $overtime_fen ;
  438. }else{
  439. $overtime_score =0;
  440. }
  441. $fault_score = $score-$fault_one_score-$fault_two_score-$fault_three_score-$weixiu_score-$overtime_score;
  442. //更新考试结果表
  443. $params['exam_id'] = $ids;
  444. $params['total'] = $fault_score;//得分;
  445. $params['fault_one_score'] = $fault_one_score;//得分;
  446. $params['fault_two_score'] = $fault_two_score;//得分;
  447. $params['fault_three_score'] = $fault_three_score;//得分;
  448. $params['xianxian_score'] = $xianxian_score;//得分;
  449. $params['xianxian_content'] = json_encode($xianxian_content);//错题;
  450. $params['yuanyin_socre'] = $yuanyin_socre;//得分;
  451. $params['yuanyin_content'] = json_encode($yuanyin_content);//错题;
  452. $params['buwei_score'] = $buwei_score;//得分;
  453. $params['buwei_content'] = json_encode($buwei_content);//错题;
  454. $params['fangfa_score'] = $fangfa_score;//得分;
  455. $params['fangfa_content'] = json_encode($fangfa_content);//错题;
  456. $params['other_jielun'] = json_encode($other_content);//每个答题的得分
  457. //
  458. $params['overtime_score'] = $overtime_score;//得分;
  459. Db::name('real_exam_score')->insert($params);
  460. $this->exam_model->where(['exam_id'=>$ids])->update(['total_score'=>$fault_score]);
  461. Db::commit();
  462. } catch (ValidateException|PDOException|Exception $e) {
  463. Db::rollback();
  464. $this->error($e->getMessage());
  465. }
  466. if ($result === false) {
  467. $this->error(__('No rows were inserted'));
  468. }
  469. $this->success('交卷成功','/admin/student/exercise/analysis/ids/'.$row['exam_id']);
  470. }
  471. $isloading =1;
  472. if(empty($row->other_replace)){
  473. $isloading = 0;
  474. $row->other_replace = '[{"fault_id":"","request_status":"0"}]';
  475. }
  476. $row->other_report_text = !empty($row->other_report) ? json_decode($row->other_report,true) : [];
  477. $row->limit_duration = $this->model->where(['exam_collection_id'=>$row['exam_collection_id']])->value('limit_duration');
  478. if(empty($row->starttime)){
  479. $timer = 60*$row->limit_duration;
  480. }else{
  481. $timer = $row->limit_duration*60 - abs(time() - $row->starttime);
  482. }
  483. if(empty($row->countdown_time)){
  484. $duration = 10+$row->limit_duration;
  485. $this->exam_model->where('exam_id',$ids)->update(['countdown_time'=>strtotime(date('Y-m-d H:i:s', strtotime('+'.$duration.' minute',$row->starttime)))]);
  486. }
  487. $departmentdata = [];
  488. $departmentdata = Fault::where(['replace_part'=>1,'sim_type'=>$row->sim_type])->order('fault_id asc')->select();
  489. $this->view->assign('departmentdata', $departmentdata);
  490. //故障现象
  491. $xianxiang = Fault::where(['fault_type'=>1,'sim_type'=>$row->sim_type])->select();
  492. $this->view->assign('xianxiang', $xianxiang);
  493. $row->replace_list =Db::name('real_exam_comp_request')->where(['exam_id'=>$ids])->select();
  494. $this->assignConfig('ids',$ids);
  495. $this->assignConfig('timer',$timer);
  496. $this->assignConfig('isloading',$isloading);
  497. $this->view->assign('row', $row);
  498. return $this->view->fetch();
  499. }
  500. public function analysis($ids = null)
  501. {
  502. if ($this->request->isPost()) {
  503. $params = $this->request->post('row/a');
  504. //计算总分到学员考试表
  505. $this->success('操作成功','/admin/student/exercise/index');
  506. }
  507. $row = Db::name('real_exam_score')->where('exam_id', $ids)->find();
  508. if (!$row) {
  509. $this->error(__('No Results were found'));
  510. }
  511. $rows = $this->exam_model->get($ids);
  512. $row['seat_id'] = $rows->seat_id;
  513. $row['user_nickname'] = $rows->user_nickname;
  514. $row['user_username'] = $rows->user_username;
  515. $row['user_depart_id'] = $rows->user_depart_id;
  516. $row['user_depart_name'] = Department::where('id',$rows->user_depart_id)->value('name');
  517. $row['start_time'] = $rows->start_time;
  518. $row['end_time'] = $rows->end_time;
  519. $fault_list = Db::name('real_exam_fault')->where(['exam_id'=>$ids,'flag'=>1])->select();
  520. $row['fault_name_one'] = !empty($fault_list[0]['fault_id']) ? Fault::where('fault_id',$fault_list[0]['fault_id'])->value('name'):'';
  521. $row['fault_name_two'] = !empty($fault_list[1]['fault_id']) ? Fault::where('fault_id',$fault_list[1]['fault_id'])->value('name'):'';
  522. $row['fault_name_three'] = !empty($fault_list[2]['fault_id']) ? Fault::where('fault_id',$fault_list[2]['fault_id'])->value('name'):'';
  523. $row['fault_score'] = 75-$row['fault_one_score']-$row['fault_two_score']-$row['fault_three_score'];
  524. $report_score = 15-$row['xianxian_score']-$row['yuanyin_socre']-$row['buwei_score']-$row['fangfa_score'];
  525. $row['report_score'] = $report_score>0?$report_score:0;
  526. $row['weixiu_score'] = 10-$row['overtime_score']??0;
  527. $other_jielun = !empty($row['other_jielun']) ? json_decode($row['other_jielun'],true):[];
  528. $this->view->assign('other_jielun', $other_jielun);
  529. $this->view->assign('row', $row);
  530. return $this->view->fetch();
  531. }
  532. }