PushMsgController.class.php
1.34 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
<?php
/**
* 直播活动消息回调通知
*/
namespace Frontend\Controller\Callback;
use Common\Model\CronModel;
use Common\Service\MainService;
use Common\Service\RangeService;
class PushMsgController extends AbstractController
{
public function __construct()
{
parent::__construct();
}
public function Index()
{
if (empty($this->callBackData) || !isset($this->callBackData['type']) || !isset($this->callBackData['lm_id'])) {
exit('SUCCESS');
}
// 获取直播活动数据
$mainServ = new MainService();
$mainDetail = $mainServ->get($this->callBackData['lm_id']);
if (empty($mainDetail)) {
exit('SUCCESS');
}
// 获取有权限观看的人员
$rangeServ = new RangeService();
list(, , $mainDetail['uids']) = $rangeServ->getWatchDataUids($mainDetail['lm_id']);
// 根据类型处理消息回调
if ($this->callBackData['type'] == CronModel::TYPE_LIVE_WILL_START) {
// 直播前X分钟推送消息
$mainServ->sendMsg($mainDetail, $mainServ::MSG_LIVE_WILL_START);
} elseif ($this->callBackData['type'] == CronModel::TYPE_LIVE_START) {
// 直播开始时
$mainServ->sendMsg($mainDetail, $mainServ::MSG_LIVE_START);
};
exit('SUCCESS');
}
}