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

试卷做过记录

@@ -193,6 +193,31 @@ class Almighty extends Api @@ -193,6 +193,31 @@ class Almighty extends Api
193 $is_wrong = '1'; 193 $is_wrong = '1';
194 } 194 }
195 } 195 }
  196 + // 记录做过的试卷
  197 + $dolog_where = [
  198 + 'user_id' => $this->auth->id,
  199 + 'traget_id' => $question['target_id'],
  200 + 'target_type' => $question['target_type']
  201 + ];
  202 + $dolog = db('mobile_dolog')->where($dolog_where)->find();
  203 + if(!$dolog){
  204 + db('mobile_dolog')->insert($dolog_where);
  205 + switch ($question['target_type']){
  206 + case '2':
  207 + Simulation::where('id',$question['target_id'])->setInc('do_num_real');
  208 + break;
  209 + case '3':
  210 + Old::where('id',$question['target_id'])->setInc('do_num_real');
  211 + break;
  212 + case '4':
  213 + Everyday::where('id',$question['target_id'])->setInc('do_num_real');
  214 + break;
  215 + case '5':
  216 + Secret::where('id',$question['target_id'])->setInc('do_num_real');
  217 + break;
  218 + default:
  219 + }
  220 + }
196 $info->allowField(true)->save([ 221 $info->allowField(true)->save([
197 'question_id' => $question_id, 222 'question_id' => $question_id,
198 'user_id' => $this->auth->id, 223 'user_id' => $this->auth->id,