LiveDetailsController.class.php 1.32 KB
<?php
/*
 * 直播-详情
 * 2018.07.19
 *
 */

namespace Api\Controller\VhLiveTotal;


use Common\Common\Constant;
use Common\Common\Department;
use Common\Common\Job;
use Common\Common\Role;
use Common\Common\Tag;
use Common\Common\User;
use Common\Common\Vhall;
use Common\Service\VhallService;

class LiveDetailsController extends AbstractController
{

    public function Index_post()
    {
        $liveId = I('post.liveId');

        if (empty($liveId)) {
            E('_EMPTY_LIVE_ID');
        }

        // 获取直播详情
        $uc_info = Vhall::instance()->details($liveId);

        $vhall_service = new VhallService();
        // 获取配置详情
        $setting_info = $vhall_service->get_by_conds(['vh_id' => $liveId]);

        // 如果是内部讲师
        if (Constant::INSIDE_TEACHER_TYPE == $setting_info['teacher_type']) {
            if ($this->uid != $setting_info['teacher_id']) {
                E('_ERR_LIVE_INFO_AUTH');
            }
            $user_info = User::instance()->getByUid($setting_info['teacher_id']);
            $setting_info['teacher_name'] = $user_info['memUsername'];
            $setting_info['teacher_face'] = $user_info['memFace'];
        }

        // 组装数据
        $uc_info = array_merge($uc_info, $setting_info);

        $this->_result = $uc_info;

        return true;
    }
}