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

合并分支 'heshupeng' 到 'master'

PC代码优化



查看合并请求 !315
... ... @@ -206,6 +206,7 @@ class Exam extends Api
$info['exam_num'] = $is_have['study_exam_num'] + 1;
}
$answer_data = [];
//单选题库
$info['dan'] = Db::name('dan')
->field('id,content,type,option,answer')
... ... @@ -221,7 +222,8 @@ class Exam extends Api
}else{
$answer['study_exam_num'] = $is_have['study_exam_num'] + 1;
}
Db::name('answer_detail')->insertGetId($answer);
// Db::name('answer_detail')->insertGetId($answer);
$answer_data[] = $answer;
$v['option'] = json_decode($v['option'],true);
if($v['type'] == 2){
foreach ($v['option'] as &$val){
... ... @@ -245,7 +247,8 @@ class Exam extends Api
}else{
$answer['study_exam_num'] = $is_have['study_exam_num'] + 1;
}
Db::name('answer_detail')->insertGetId($answer);
// Db::name('answer_detail')->insertGetId($answer);
$answer_data[] = $answer;
$v['option'] = json_decode($v['option'],true);
if($v['type'] == 2){
foreach ($v['option'] as &$val){
... ... @@ -269,7 +272,8 @@ class Exam extends Api
}else{
$answer['study_exam_num'] = $is_have['study_exam_num'] + 1;
}
Db::name('answer_detail')->insertGetId($answer);
// Db::name('answer_detail')->insertGetId($answer);
$answer_data[] = $answer;
$v['option'] = array([
'name'=>'A',
'gender'=>'正确'
... ... @@ -280,7 +284,7 @@ class Exam extends Api
]
);
}
Db::name('answer_detail')->insertAll($answer_data);
$this->success('success',$info);
... ...
... ... @@ -621,7 +621,7 @@ class User extends Api
->select();
foreach ($data['info'] as &$v){
if($v['status'] == 1){
$proportion = floor($v['playtime']/$v['duration']*100);
$proportion = $v['duration'] > 0 ? floor($v['playtime']/$v['duration']*100) : 0;
$v['proportion'] = ($proportion >= 100 ? 99 : $proportion).'%';
}else{
$v['proportion'] = '100%';
... ...