public function create(RESTRequest $request)
 {
     $stb_list = $request->getConvertedIdentifiers();
     $identifiers = $request->getIdentifiers();
     if (empty($stb_list) && !empty($identifiers)) {
         throw new RESTCommandException('STB not found');
     }
     $event = new SysEvent();
     if (empty($identifiers)) {
         $event->setUserListByMac('all');
     } else {
         $event->setUserListById($stb_list);
     }
     if ($request->getData('ttl')) {
         $event->setTtl($request->getData('ttl'));
     }
     switch ($request->getData('event')) {
         case 'send_msg':
             if ($request->getData('need_reboot')) {
                 $event->sendMsgAndReboot($request->getData('msg'));
             } else {
                 $event->sendMsg($request->getData('msg'));
             }
             if ($request->getData('auto_hide_timeout')) {
                 $event->setAutoHideTimeout($request->getData('auto_hide_timeout'));
             }
             break;
         case 'send_msg_with_video':
             $event->sendMsgWithVideo($request->getData('msg'), $request->getData('video'));
             break;
         case 'reboot':
             $event->sendReboot();
             break;
         case 'reload_portal':
             $event->sendReloadPortal();
             break;
         case 'update_channels':
             $event->sendUpdateChannels();
             break;
         case 'play_channel':
             $event->sendPlayChannel($request->getData('channel'));
             break;
         case 'play_radio_channel':
             $event->sendPlayRadioChannel($request->getData('channel'));
             break;
         case 'update_image':
             $event->sendUpdateImage();
             break;
         case 'cut_off':
             $event->sendCutOff();
             break;
         case 'show_menu':
             $event->sendShowMenu();
             break;
         default:
             return false;
     }
     return true;
 }
Пример #2
0
            $event->sendMsgWithVideo(@$_POST['msg'], @$_POST['video_url']);
            break;
        case 'reboot':
            $event->sendReboot();
            break;
        case 'reload_portal':
            $event->sendReloadPortal();
            break;
        case 'update_channels':
            $event->sendUpdateChannels();
            break;
        case 'play_channel':
            $event->sendPlayChannel(@$_POST['channel']);
            break;
        case 'update_image':
            $event->sendUpdateImage();
            break;
    }
}
$mac = '';
if (!empty($_POST['mac'])) {
    $mac = $_POST['mac'];
} else {
    if (!empty($_GET['mac'])) {
        $mac = $_GET['mac'];
    }
}
$uid = Middleware::getUidByMac($mac);
$events = Event::getAllNotEndedEvents($uid);
$debug = '<!--' . ob_get_contents() . '-->';
ob_clean();