<?php /** * 微吼直播活动消息回调通知 */ namespace Frontend\Controller\Callback; use Common\Common\Vhall; use Common\Model\CronModel; use Common\Service\MainService; use Common\Service\RangeService; use Common\Service\VhallService; use Common\Service\VhMsgLogService; use Think\Log; class PushVhMsgController 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'); } Log::write('欢迎进入定时任务-------------' . print_r($this->callBackData, true)); // 获取直播活动数据 $uc_info = Vhall::instance()->details($this->callBackData['lm_id']); if (empty($uc_info)) { exit('SUCCESS'); } Log::write('欢迎进入定时任务详情-------------' . print_r($uc_info, true)); $liveScops = $uc_info['liveScope']; $uc_info['liveScopeAll'] = $liveScops['brAll']; $vh_msg = new VhMsgLogService(); $auth_info['liveScopeUsers'] = $liveScops['userIds']; $auth_info['liveScopeDepts'] = $liveScops['dpIds']; $auth_info['liveScopeTags'] = $liveScops['tagIds']; $auth_info['liveScopeJobs'] = $liveScops['jobIds']; $auth_info['liveScopeRoles'] = $liveScops['roleIds']; // 获取有权限的用户UIDS集合 $uc_info['liveScopeUsers'] = $vh_msg->get_auth_uids($auth_info); Log::write('权限用户-------------' . print_r($uc_info, true)); $service = new VhallService(); $info = $service->get_by_conds(['vh_id' => $this->callBackData['lm_id']]); $uc_info = array_merge($uc_info, $info); // 根据类型处理消息回调 if ($this->callBackData['type'] == CronModel::TYPE_LIVE_WILL_START) { Log::write('直播前推动消息'); // 直播前X分钟推送消息 $vh_msg->send_vh_Msg($uc_info, $vh_msg::MSG_LIVE_WILL_START); } elseif ($this->callBackData['type'] == CronModel::TYPE_LIVE_START) { Log::write('直播开始推动消息'); // 直播开始时 $vh_msg->send_vh_Msg($uc_info, $vh_msg::MSG_LIVE_START); }; exit('SUCCESS'); } }