PlanListController.class.php
1.36 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
<?php
/**
* 【后台】签到计划列表接口
*
* PlanListController.class.php
* User: caijianhua
* Date: 2017/8/29
* Time: 下午5:15
*/
namespace Apicp\Controller\Sign;
use Common\Service\PlanService;
class PlanListController extends \Apicp\Controller\AbstractController
{
/** @var PlanService 培训计划表 */
protected $plan_service;
public function before_action($action = '')
{
if (!parent::before_action($action)) {
return false;
}
$this->plan_service = new PlanService();
return true;
}
/**
* 签到计划标签表
* @author 蔡建华
*/
public function Index_post()
{
$ed_id = I('post.ed_id', 'int', 0);
if (empty($ed_id)) {
// 培训ID不能未空
E('_EMPTY_ED_ID');
}
$conds = [
'ed_id' => $ed_id,// 培训ID
'plan_type' => PlanService::PLAN_TYPE_SIGN
];
// 排序方式
$order = ['plan_order' => 'ASC', 'plan_id' => 'DESC'];
// 返回字段
$field = 'plan_id,plan_name';
// 查询签到计划
$data = $this->plan_service->list_by_conds($conds, [], $order, $field);
foreach ($data as &$val) {
$val['plan_id'] = intval($val['plan_id']);
}
$this->_result = ['list' => $data];
return true;
}
}