This commit is contained in:
aozhiwei 2024-08-01 12:03:21 +08:00
parent d04f973cf1
commit d654bd893c
2 changed files with 39 additions and 3 deletions

View File

@ -276,15 +276,27 @@ class BaseController {
return $channel == "0000";
}
public function _getServiceConstant($serviceName, $name)
{
$this->_mustBeLoadService($serviceName);
$reflectionConstant = new ReflectionClassConstant('services\\' . $serviceName, $name);
return $reflectionConstant->getValue();;
}
public function _callServiceStatic($serviceName, $funcName, ...$args)
{
$this->_mustBeLoadService($serviceName);
$method = new ReflectionMethod('services\\' . $serviceName, $funcName);
$ret = $method->invoke(null, ...$args);
return $ret;
}
private function _mustBeLoadService($serviceName)
{
if (!array_key_exists($serviceName, $this->serviceHash)) {
require_once('services/' . $serviceName . '.php');
$this->serviceHash[$serviceName] = $this->_getNowTime();
}
$method = new ReflectionMethod('services\\' . $serviceName, $funcName);
$ret = $method->invoke(null, ...$args);
return $ret;
}
public function _getGameId() {

24
webapp/mt/Bigwheel.php Normal file
View File

@ -0,0 +1,24 @@
<?php
namespace mt;
use phpcommon;
class Bigwheel
{
public static function get($id)
{
return getXVal(self::getMetaList(), $id);
}
protected static function getMetaList()
{
if (!self::$metaList) {
self::$metaList = getMetaTable('Bigwheel@Bigwheel.php');
}
return self::$metaList;
}
protected static $metaList;
}