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

合并分支 'heshupeng' 到 'master'

PC端答题优化



查看合并请求 !255
... ... @@ -482,7 +482,7 @@ class Exam extends Api
if($correct == $answer){
Db::name('answer_detail')->where('id',$data['id'])->update(['answer'=>$answer,'score'=>$study['dan_score']]);
}else{
Db::name('answer_detail')->where('id',$data['id'])->update(['answer'=>$answer]);
Db::name('answer_detail')->where('id',$data['id'])->update(['answer'=>$answer,'score'=>0]);
}
//算出总得分
$score = Db::name('answer_detail')
... ... @@ -518,9 +518,9 @@ class Exam extends Api
$correct = explode(',',$correct);
}
if(!empty($answer)){
$answer = explode(',',$answer);
$answer1 = explode(',',$answer);
}
$result = array_diff($correct,$answer);
$result = count($answer1) > count($correct) ? array_diff($answer1,$correct) : array_diff($correct,$answer1);
//判断用户是否回答正确
if(empty($result)){
... ... @@ -528,7 +528,7 @@ class Exam extends Api
Db::name('answer_detail')->where('id',$data['id'])->update(['answer'=>$answer,'score'=>$study['duo_score']]);
}else{
//回答错误
Db::name('answer_detail')->where('id',$data['id'])->update(['answer'=>$answer]);
Db::name('answer_detail')->where('id',$data['id'])->update(['answer'=>$answer,'score'=>0]);
}
//算出总得分
... ... @@ -564,7 +564,7 @@ class Exam extends Api
if($correct == $answer){
Db::name('answer_detail')->where('id',$data['id'])->update(['answer'=>$answer,'score'=>$study['pan_score']]);
}else{
Db::name('answer_detail')->where('id',$data['id'])->update(['answer'=>$answer]);
Db::name('answer_detail')->where('id',$data['id'])->update(['answer'=>$answer,'score'=>0]);
}
//算出总得分
$score = Db::name('answer_detail')
... ...