MoveController.class.php 855 Bytes
<?php
/**
 * 【考试中心-后台】批量移动试题到指定题库
 * MoveController.class.php
 * @author: pw
 * @email:  254995618@qq.com
 * @date :  2018-05-16 16:15:33
 * @version $Id$
 */

namespace Apicp\Controller\Topic;

class MoveController extends AbstractController
{
    public function Index_post()
    {
        // 所选题目ids
        $etIds = I('post.et_ids');

        // 目标题库id
        $ebId = I('post.eb_id');

        if (!$etIds || empty($etIds)) {
            E('_EMPTY_ET_ID');
        }

        if (!$ebId || 0 == $ebId) {
            E('_EMPTY_EB_ID');
        }

        // 去重去空
        $etIds = array_unique(array_filter($etIds));

        // 修改题目所属题库
        if (!$this->topic_service->move_topic($etIds, (int)$ebId)) {

            return false;
        }

        return true;
    }
}