DetailController.class.php
1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
* 【考试中心-手机端】5-获取考试结果接口
* DetailController.class.php
* @author: 蔡建华
* @date: 2017-05-23
*/
namespace Api\Controller\Answer;
use Common\Service\AnswerService;
use Common\Service\PaperService;
class DetailController extends AbstractController
{
public function Index_post()
{
// 接收post参数
$params = I('post.');
// 答卷id
$ea_id = $params['ea_id'];
// 答卷ID不能为空
if (empty($ea_id)) {
E('_EMPTY_EA_ID');
}
// 实例化答卷service
$answer_s = new AnswerService();
// 答卷详情
$answer_info = $answer_s->get_by_conds(['ea_id' => $ea_id, 'uid' => $this->uid]);
// 答卷详情为空:答卷不存在
if (empty($answer_info)) {
E('_ERR_ANSWER_NOT_FOUND');
}
// 试卷id
$ep_id = $answer_info['ep_id'];
// 实例化试卷service
$paper_s = new PaperService();
// 根据试卷id查询试卷信息
$paper = $paper_s->get($ep_id);
// 试卷信息不存在,返回提示"试卷信息不存在"
if (empty($paper)) {
E('_EMPTY_PAPER_DATA');
}
// 查询答卷数据,返回数据包括:试卷信息、答题情况列表数据
$result = $answer_s->answer_detail_info($params, $this->_login->user,$answer_info,$paper);
// 返回结果
$this->_result = $result;
}
}