CreateController.class.php
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?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;
}
}