ListController.class.php 1.13 KB
<?php
/**
 * 【手机端】12-培训评价项接口(待定)
 * Created by PhpStorm.
 * @author:wanghuan
 * @date:2017-08-31
 */

namespace Api\Controller\Options;

use Common\Service\CommentOptionsService;

class ListController extends \Api\Controller\AbstractController
{

    /**
     * 评价项
     */
    public function Index_post()
    {

        // 培训id
        $ed_id = I('post.ed_id', 0, 'intval');
        // 培训id为空
        if (!$ed_id) {

            E('_EMPTY_ED_ID');
        }

        // 培训详情
        $this->get_education($ed_id);

        // 实例化评分项service
        $comment_options_s = new CommentOptionsService();
        // 查询条件
        $cond['ed_id'] = $ed_id;
        // 培训评分项
        $options = $comment_options_s->list_by_conds($cond);

        $list = [];
        foreach ($options as $key => $val) {

            $list[$key] = [
                'option_id' => intval($val['option_id']),
                'option_name' => $val['option_name'],
                'option_score' => intval($val['option_score'])
            ];
        }

        $this->_result = $list;
    }
}