StartBreakController.class.php 883 Bytes
<?php
/**
 * 【考试中心-手机端】开始闯关接口
 * StartBreakController.class.php
 * @author: 蔡建华
 * @date: 2017-05-23
 */

namespace Api\Controller\Breakthrough;

use Common\Service\TopicService;

class StartBreakController extends AbstractController
{

    public function Index_post()
    {
        // 接收post参数
        $params = I('post.');

        // 实例化闯关答卷service
        $break_serv = new TopicService();

        // 课程id
        $ec_id = intval($params['ec_id']);
        // 试题id,多个逗号分隔
        $et_ids = $params['et_ids'];
        // 开始闯关数据保存
        $res = $break_serv->start_break($ec_id, $et_ids);
        // 操作失败,返回false
        if (!$res) {

            return false;
        }

        // 返回结果
        $this->_result = ['list' => $res];

        return true;
    }
}