作者 何书鹏
1 个管道 的构建 通过 耗费 3 秒

合并分支 'heshupeng' 到 'master'

答题bug修改



查看合并请求 !258
@@ -439,10 +439,13 @@ class Exam extends Api @@ -439,10 +439,13 @@ class Exam extends Api
439 { 439 {
440 $user_id = $this->auth->id; 440 $user_id = $this->auth->id;
441 $study_id = $this->request->param('study_id'); 441 $study_id = $this->request->param('study_id');
442 - $question_id = $this->request->param('question_id'); 442 + $question_id = $this->request->param('question_id/a');
443 $type = $this->request->param('type'); 443 $type = $this->request->param('type');
444 $answer = $this->request->param('answer'); 444 $answer = $this->request->param('answer');
445 - 445 +
  446 + // 题目ID过滤
  447 + $question_id = implode(',',array_filter($question_id));
  448 +
446 $study_exam_num = $this->request->param('study_exam_num'); 449 $study_exam_num = $this->request->param('study_exam_num');
447 if(empty($study_id) || empty($question_id) || empty($type) || empty($study_exam_num)){ 450 if(empty($study_id) || empty($question_id) || empty($type) || empty($study_exam_num)){
448 $this->error('缺少必要参数'); 451 $this->error('缺少必要参数');
@@ -515,7 +518,7 @@ class Exam extends Api @@ -515,7 +518,7 @@ class Exam extends Api
515 ->value('answer'); 518 ->value('answer');
516 519
517 if(!empty($correct)){ 520 if(!empty($correct)){
518 - $correct = explode(',',$correct); 521 + $correct = str_split(str_replace([',',',',' '],'',$correct));
519 } 522 }
520 $answer1 = []; 523 $answer1 = [];
521 if(!empty($answer)){ 524 if(!empty($answer)){
@@ -558,7 +561,7 @@ class Exam extends Api @@ -558,7 +561,7 @@ class Exam extends Api
558 $this->error('参数有误'); 561 $this->error('参数有误');
559 }else{ 562 }else{
560 //查询该题的正确答案 563 //查询该题的正确答案
561 - $correct = Db::name('dan') 564 + $correct = Db::name('pan')
562 ->where('id',$question_id) 565 ->where('id',$question_id)
563 ->value('answer'); 566 ->value('answer');
564 //判断用户是否回答正确 567 //判断用户是否回答正确