SignListController.class.php 1.09 KB
<?php
/**
 * Created by PhpStorm.
 * User: zhonglei
 * Date: 2018/5/18
 * Time: 16:25
 */
namespace Apicp\Controller\Course;

use Common\Service\SignService;
use Common\Service\CourseArticleService;

class SignListController extends \Apicp\Controller\AbstractController
{
    /**
     * SignList
     * @author zhonglei
     * @desc 线下课程签到列表接口
     */
    public function Index_post()
    {
        $params = I('post.');

        if (empty($params['article_id'])) {
            E('_ERR_ARTICLE_ID_NOT_FOUND');
        }

        $page = !empty($params['page']) ? intval($params['page']) : self::PAGE_DEFAULT;
        $limit = !empty($params['limit']) ? intval($params['limit']) : self::PAGE_LIMIT_DEFAULT;

        list($start, $limit) = page_limit($page, $limit);
        $page_option = [$start, $limit];

        $signServ = new SignService();
        $this->_result = $signServ->sign_search_list($params, $page_option);

        $articleServ = new CourseArticleService();
        $this->_result['qrcode_url'] = $articleServ->getSignQrcodeUrl($params['article_id']);
        return true;
    }
}