ListInfoController.class.php 1.14 KB
<?php
/**
 * 获取试卷详情
 * ListInfoController.class.php
 * User: daijun
 * Date: 2017年09月05日
 */

namespace Rpc\Controller\Train;

use Common\Service\PaperService;

class ListInfoController extends AbstractController
{

    public function Index()
    {

        // 获取考试试卷ID
        $params = $this->_params;

        $app_data_ids = $params['app_data_ids'];

        $paper_serv = new PaperService();

        $conds = array(
            'ep_id' => $app_data_ids,
            'exam_type' => PaperService::TRAIN_TYPE
        );

        // 查询试卷列表
        $list = $paper_serv->list_by_conds($conds, null, [], 'ep_id,ep_name,ep_type,exam_status,paper_type');

        $result = [];

        // 循环格式化返回数据
        foreach ($list as $v) {
            $arr = array(
                'app_data_id' => intval($v['ep_id']),
                'title' => $v['ep_name'],
                'ep_type' => intval($v['ep_type']),
                'exam_status' => intval($v['exam_status']),
                'paper_type' => intval($v['paper_type']),
            );

            $result[] = $arr;
        }

        return $result;
    }
}