RandomSnapshotService.class.php
1.72 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
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/**
* 随机题库快照类
* @author: caijianhua
* @email: juxinggaozhao@163.com
* @date : 2017-07-17
* @version $Id$
*/
namespace Common\Service;
use Common\Model\RandomSnapshotModel;
class RandomSnapshotService extends AbstractService
{
// 构造方法
public function __construct()
{
$this->_d = new RandomSnapshotModel();
parent::__construct();
}
/**
* 获取选题列表
*
* @param int $ep_id 试卷id
* @param string $fields 返回字段
*
* @return array|bool
*/
public function get_random_snapshot_list($ep_id = 0, $fields = 'et_id,title')
{
// 查询选题列表
$list = $this->_d->list_by_conds(['ep_id' => $ep_id], null, ['order_num' => 'ASC'], $fields);
// 格式化数据
foreach ($list as $k => $v) {
$list[$k]['et_id'] = intval($v['et_id']);
}
return $list;
}
/**
* 获取试题快照列表
*
* @author caijianhua
* @param array $conds 查询条件参数列表
* @param array $page_option 分页参数
* @param array $order_option 排序参数
* @param string $fields 返回字段
*
* @return array|bool
*/
public function conds_random_snapshot_list($conds, $page_option = null, $order_option = [], $fields = '*')
{
return $this->_d->conds_random_snapshot_list($conds, $page_option, $order_option, $fields);
}
/**
* 获取试题快照总数
*
* @author caijainhua
* @param array $conds 查询条件参数列表
*
* @return int
*/
public function conds_random_snapshot_count($conds)
{
return $this->_d->conds_random_snapshot_count($conds);
}
}