checkLogin(); // 接收参数 $recordId = request('record_id',0); // 如果不是课中习题 if( !$recordId ) return json_send(['code'=>'error','msg'=>'请选择评测记录']); // 查询答题记录 $answerList = $Model->query() ->where([['custom_uid','=',$uid],['record_id','=',$recordId]]) ->select(['id','record_id','course_id','question_id','answer_id','is_answer','get_score']) ->get()->toArray(); // 循环答题 foreach ($answerList as $key => $value) { // 题目标题 $value['question_title']= $VideoQuestion->getOne($value['question_id'],'title'); $value['answer_list'] = $VideoAnswer->getListByQuestion($value['question_id']); $value['answer_list'] = array_values($value['answer_list']); // 重组 $answerList[$key] = $value; } // 返回结果 return json_send(['code'=>'success','msg'=>'获取成功','data'=>$answerList]); } }