game2006api/webapp/controller/UnitTestController.class.php
2024-07-30 14:46:52 +08:00

45 lines
1.3 KiB
PHP

<?php
require_once('services/NoticeService.php');
class UnitTestController extends BaseAuthedController {
public function _handlePre()
{
parent::_handlePre();
if (SERVER_ENV == _ONLINE) {
die("can't create UnitTestController");
return;
}
}
public function testNotice()
{
try {
$marqueeType= getReqVal('type', 1);
$loop = getReqVal('loop', 1);
$interval = getReqVal('interval', 10);
$contents= file_get_contents('php://input');
$postdata = json_decode($contents, true);
$content = '';
if ($marqueeType == 1) {
$elements = $postdata["elements"];
$content = services\NoticeService::buildCustom($elements);
} else if ($marqueeType == 2) {// deprecated
$langKey = $postdata["lang_key"];
$langParams = $postdata["lang_params"];
$content = services\NoticeService::buildMulLangTemplate($langKey, $langParams);
} else {
return;
}
services\NoticeService::send($content, $loop, $interval);
} catch (Exception $e){
error_log($e);
}
}
}