<?php /* * CreateController * 微吼 直播-创建 * 2018.07.19 * */ namespace Apicp\Controller\VhLiveOperate; use Common\Common\Constant; use Common\Common\Vhall; use Common\Model\CronModel; use Common\Service\VhMsgLogService; class CreateController extends AbstractController { /*** * 微吼 - 创建直播 * @return bool */ public function Index_post() { $params = I('post.'); //获取直播中 更多设置 $setting = $this->getLiveSetting($params, Constant::VH_MORE_SETTING_FIELD); $params['liveHost']=$params['teacher_name']; //创建直播 $liveInfo = Vhall::instance()->add($params); if (!$liveInfo) { E('_ERR_CREATE_LIVE_FAILED'); } //记录直播标识 存储直播设置 $setting['vh_id'] = $liveInfo['id']; $id = $this->vhall_service->insert($setting); if (!$id) { E('_ERR_CREATE_LIVE_SETTING_FAILED'); } if ($params['livePublished'] == Constant::TYPE_LIVE_PUBLISH) { //组装 推荐数据,消息提醒 $params['id'] = $liveInfo['id']; $params['liveVhallId'] = $liveInfo['liveVhallId']; //如果内部讲师 推送消息 if ($params['teacher_type'] == Constant::INSIDE_TEACHER_TYPE) { //复制数据 导师发送消息过程需 去除权限数据 $data = $params; $this->vhMsgLogServ->send_teacher_msg($data, Constant::MSG_LECTURER_APPOINTMENT); } //推送消息 给参与范围内的 $this->dealWithMoreSetting($params); } $this->_result = $liveInfo; return true; } }