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

查看答案解析列表

... ... @@ -359,4 +359,62 @@ class Old extends Api
}
$this->success('成功',compact('info','list','course'));
}
/**
* @ApiTitle (查看答案解析)
* @ApiSummary (查看答案解析)
* @ApiMethod (POST)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="old_id", type="int", required=true, description="试卷ID")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1606974837",
"data": [{
"id": 34, //题目ID
"title": "添加一个测试题目", //题目
"option": "[{\"key\":\"A\",\"value\":\"1\"},{\"key\":\"B\",\"value\":\"2\"},{\"key\":\"C\",\"value\":\"3\"},{\"key\":\"D\",\"value\":\"5\"}]", //选项
"type": "1", //题目类型:1=单选题,2=多选题,3=判断题,4=简答题
"answer": "C", //正确答案
"analysis_video": { //解析视频
"cover": "http://www.enterprise.top/assets/img/bg-middle.jpg",
"video": "https://vd2.bdstatic.com/mda-keihfqfq553in3js/sc/mda-keihfqfq553in3js.mp4?playlist=%5B%22hd%22%2C%22sc%22%5D&auth_key=1600505506-0-0-61050652001d98b5ffecfbface23d4f2&bcevod_channel=searchbox_feed&pd=1&pt=3"
},
"analysis_text": "Cookie 并不是它的原意“甜饼”的意思, 而是一个保存在客户机中的简单的文本文件, 这个文件与特定的 Web 文档关联在一起, 保存了该客户机访问这个 Web 文档时的信息, 当客户机再次访问这个 Web 文档时这些信息可供该文档使用。由于“Cookie”具有可以保存在客户机上的神奇特性, 因此它可以帮助我们实现记录用户个人信息的功能, 而这一切都不必使用复杂的 CGI 等程序。", //解析文字
"note": null, //笔记
"is_collect": 0, //是否收藏:0=否,1=是
"status": 2, //状态:0=未答,1=答对,2=答错
"my_answer": "A" //我的答案
}]
})
*/
public function analysisList()
{
$old_id = $this->request->param('old_id');
empty($old_id) && $this->error('缺少必要参数');
$list = Question::alias('q')
->join('mobile_question_note qn','q.id = qn.question_id and qn.user_id='.$this->auth->id,'left')
->join('mobile_question_collect qc','q.id = qc.question_id and qc.user_id='.$this->auth->id,'left')
->join('mobile_question_answer qa','q.id = qa.question_id and qa.user_id='.$this->auth->id,'left')
->where('q.target_type',3)
->where('q.target_id',$old_id)
->field('
q.id,
q.title,
q.option,
q.type,
q.answer,
q.analysis_video,
q.analysis_text,
qn.content note,
if(qc.id > 0,1,0) is_collect,
if(qa.id > 0,if(qa.is_wrong="0",1,2),0) status,
qa.content my_answer
')->order(['type'=>'asc'])
->select();
$this->success('成功',$list);
}
}
\ No newline at end of file
... ...
... ... @@ -359,4 +359,62 @@ class Simulation extends Api
}
$this->success('成功',compact('info','list','course'));
}
/**
* @ApiTitle (查看答案解析)
* @ApiSummary (查看答案解析)
* @ApiMethod (POST)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="simulation_id", type="int", required=true, description="试卷ID")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1606974837",
"data": [{
"id": 34, //题目ID
"title": "添加一个测试题目", //题目
"option": "[{\"key\":\"A\",\"value\":\"1\"},{\"key\":\"B\",\"value\":\"2\"},{\"key\":\"C\",\"value\":\"3\"},{\"key\":\"D\",\"value\":\"5\"}]", //选项
"type": "1", //题目类型:1=单选题,2=多选题,3=判断题,4=简答题
"answer": "C", //正确答案
"analysis_video": { //解析视频
"cover": "http://www.enterprise.top/assets/img/bg-middle.jpg",
"video": "https://vd2.bdstatic.com/mda-keihfqfq553in3js/sc/mda-keihfqfq553in3js.mp4?playlist=%5B%22hd%22%2C%22sc%22%5D&auth_key=1600505506-0-0-61050652001d98b5ffecfbface23d4f2&bcevod_channel=searchbox_feed&pd=1&pt=3"
},
"analysis_text": "Cookie 并不是它的原意“甜饼”的意思, 而是一个保存在客户机中的简单的文本文件, 这个文件与特定的 Web 文档关联在一起, 保存了该客户机访问这个 Web 文档时的信息, 当客户机再次访问这个 Web 文档时这些信息可供该文档使用。由于“Cookie”具有可以保存在客户机上的神奇特性, 因此它可以帮助我们实现记录用户个人信息的功能, 而这一切都不必使用复杂的 CGI 等程序。", //解析文字
"note": null, //笔记
"is_collect": 0, //是否收藏:0=否,1=是
"status": 2, //状态:0=未答,1=答对,2=答错
"my_answer": "A" //我的答案
}]
})
*/
public function analysisList()
{
$simulation_id = $this->request->param('simulation_id');
empty($simulation_id) && $this->error('缺少必要参数');
$list = Question::alias('q')
->join('mobile_question_note qn','q.id = qn.question_id and qn.user_id='.$this->auth->id,'left')
->join('mobile_question_collect qc','q.id = qc.question_id and qc.user_id='.$this->auth->id,'left')
->join('mobile_question_answer qa','q.id = qa.question_id and qa.user_id='.$this->auth->id,'left')
->where('q.target_type',2)
->where('q.target_id',$simulation_id)
->field('
q.id,
q.title,
q.option,
q.type,
q.answer,
q.analysis_video,
q.analysis_text,
qn.content note,
if(qc.id > 0,1,0) is_collect,
if(qa.id > 0,if(qa.is_wrong="0",1,2),0) status,
qa.content my_answer
')->order(['type'=>'asc'])
->select();
$this->success('成功',$list);
}
}
\ No newline at end of file
... ...
此 diff 太大无法显示。