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

试卷做过记录

... ... @@ -193,6 +193,31 @@ class Almighty extends Api
$is_wrong = '1';
}
}
// 记录做过的试卷
$dolog_where = [
'user_id' => $this->auth->id,
'traget_id' => $question['target_id'],
'target_type' => $question['target_type']
];
$dolog = db('mobile_dolog')->where($dolog_where)->find();
if(!$dolog){
db('mobile_dolog')->insert($dolog_where);
switch ($question['target_type']){
case '2':
Simulation::where('id',$question['target_id'])->setInc('do_num_real');
break;
case '3':
Old::where('id',$question['target_id'])->setInc('do_num_real');
break;
case '4':
Everyday::where('id',$question['target_id'])->setInc('do_num_real');
break;
case '5':
Secret::where('id',$question['target_id'])->setInc('do_num_real');
break;
default:
}
}
$info->allowField(true)->save([
'question_id' => $question_id,
'user_id' => $this->auth->id,
... ...