game2006api/webapp/controller/UnitTestController.class.php
aozhiwei 559c18cd98 1
2024-07-31 19:06:53 +08:00

44 lines
1.3 KiB
PHP

<?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;
}
myself()->_callServiceStatic('NoticeService', 'send', $content, $loop, $interval);
//services\NoticeService::send($content, $loop, $interval);
} catch (Exception $e){
error_log($e);
}
}
}