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

试卷做过人数

@@ -193,15 +193,14 @@ class Almighty extends Api @@ -193,15 +193,14 @@ class Almighty extends Api
193 $is_wrong = '1'; 193 $is_wrong = '1';
194 } 194 }
195 } 195 }
196 - // 记录做过的试卷 196 + // 记录试卷做过人数
197 $dolog_where = [ 197 $dolog_where = [
198 'user_id' => $this->auth->id, 198 'user_id' => $this->auth->id,
199 'traget_id' => $question['target_id'], 199 'traget_id' => $question['target_id'],
200 'target_type' => $question['target_type'] 200 'target_type' => $question['target_type']
201 ]; 201 ];
202 - $dolog = db('mobile_dolog')->where($dolog_where)->find(); 202 + $dolog = QuestionAnswer::where($dolog_where)->find();
203 if(!$dolog){ 203 if(!$dolog){
204 - db('mobile_dolog')->insert($dolog_where);  
205 switch ($question['target_type']){ 204 switch ($question['target_type']){
206 case '2': 205 case '2':
207 Simulation::where('id',$question['target_id'])->setInc('do_num_real'); 206 Simulation::where('id',$question['target_id'])->setInc('do_num_real');
@@ -220,6 +219,8 @@ class Almighty extends Api @@ -220,6 +219,8 @@ class Almighty extends Api
220 } 219 }
221 $info->allowField(true)->save([ 220 $info->allowField(true)->save([
222 'question_id' => $question_id, 221 'question_id' => $question_id,
  222 + 'target_id' => $question['target_id'],
  223 + 'target_type' => $question['target_type'],
223 'user_id' => $this->auth->id, 224 'user_id' => $this->auth->id,
224 'content' => $answer, 225 'content' => $answer,
225 'is_wrong' => $is_wrong, 226 'is_wrong' => $is_wrong,