ExamService.class.php 1.67 KB
<?php
/**
 * Created by PhpStorm.
 * User: zhonglei
 * Date: 2017/6/5
 * Time: 14:33
 */
namespace Common\Service;

use Com\Rpc;
use Common\Common\Constant;
use Common\Model\ExamModel;

class ExamService extends AbstractService
{
    // 构造方法
    public function __construct()
    {
        parent::__construct();
        $this->_d = new ExamModel();
    }

    /**
     * @desc 根据题目ID获取题目列表
     * @author tangxingguo
     * @param array $etIds 题目ID
     * @return array 题目列表
     */
    public function listById($etIds)
    {
        if (!is_array($etIds)) {

            return [];
        }

        $param_arr = [
            'et_ids' => implode(',', $etIds),
        ];

        $url = rpcUrl('/Exam/Rpc/Breakthrough/TopicList');
        $res = Rpc::phprpc($url)->invoke('Index', $param_arr);
        $res = json_decode($res, true);
        $list = isset($res['list']) ? $res['list'] : [];
        $etTypeList = Constant::EXAM_TYPE_LIST;
        foreach ($list as $k => $v) {

            $list[$k]['et_type'] = isset($etTypeList[$v['et_type']]) ? $etTypeList[$v['et_type']] : '';
        }

        return $list;
    }

    /**
     * 根据条件获取测评人员列表
     * @author liyifei
     * @param array $conds 条件
     * @param array $pages 分页
     * @return array
     */
    public function listUidByConds($conds, $pages)
    {

        return $this->_d->listUidByConds($conds, $pages);
    }

    /**
     * 根据条件,获取测评人员总数
     * @author liyifei
     * @param array $conds 条件
     * @return array
     */
    public function countUidByConds($conds)
    {
        return $this->_d->countUidByConds($conds);
    }
}