<?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; } }