game2006api/webapp/controller/UnitTestController.class.php
hujiabin 66007b6e0f 1
2024-08-19 17:23:32 +08:00

52 lines
1.5 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('testNotice:' . $e);
}
}
public function testEvent()
{
myself()->_fireEvent('Battle', 'onSettlement', array(
'account_id' => 'xxx',
'id' => 'bbb',
));
}
}