1
This commit is contained in:
parent
112e52ec9d
commit
b4b97656e6
@ -10,7 +10,7 @@ class BaseController {
|
||||
private $relationDbConn = null;
|
||||
private $mailDbConn = null;
|
||||
private $timeOffset = 0;
|
||||
private $serviceHash = array();
|
||||
private $moduleHash = array();
|
||||
|
||||
function __construct()
|
||||
{
|
||||
@ -278,24 +278,56 @@ class BaseController {
|
||||
|
||||
public function _getServiceConstant($serviceName, $name)
|
||||
{
|
||||
$this->_mustBeLoadService($serviceName);
|
||||
$reflectionConstant = new ReflectionClassConstant('services\\' . $serviceName, $name);
|
||||
return $reflectionConstant->getValue();;
|
||||
return $this->_internalGetModuleConstant('services', $serviceName, $name);
|
||||
}
|
||||
|
||||
public function _callServiceStatic($serviceName, $funcName, ...$args)
|
||||
{
|
||||
$this->_mustBeLoadService($serviceName);
|
||||
$method = new ReflectionMethod('services\\' . $serviceName, $funcName);
|
||||
return $this->_internalCallModuleStatic('services', $serviceName, $funcName, ... $args);
|
||||
}
|
||||
|
||||
public function _getModelConstant($modelName, $name)
|
||||
{
|
||||
return $this->_internalGetModuleConstant('models', $modelName, $name);
|
||||
}
|
||||
|
||||
public function _callModelStatic($modelName, $funcName, ...$args)
|
||||
{
|
||||
return $this->_internalCallModuleStatic('models', $modelName, $funcName, ... $args);
|
||||
}
|
||||
|
||||
public function _getMtConstant($modelName, $name)
|
||||
{
|
||||
return $this->_internalGetModuleConstant('mt', $modelName, $name);
|
||||
}
|
||||
|
||||
public function _callMtStatic($modelName, $funcName, ...$args)
|
||||
{
|
||||
return $this->_internalCallModuleStatic('mt', $modelName, $funcName, ... $args);
|
||||
}
|
||||
|
||||
private function _internalGetModuleConstant($dir, $moduleName, $name)
|
||||
{
|
||||
$fullName = $dir . '\\' . $moduleName;
|
||||
$this->_internalMustBeLoadModule($fullName);
|
||||
$reflectionConstant = new ReflectionClassConstant($fullName, $name);
|
||||
return $reflectionConstant->getValue();;
|
||||
}
|
||||
|
||||
private function _internalCallModuleStatic($dir, $moduleName, $funcName, ...$args)
|
||||
{
|
||||
$fullName = $dir . '\\' . $moduleName;
|
||||
$this->_internalMustBeLoadModule($fullName);
|
||||
$method = new ReflectionMethod($fullName, $funcName);
|
||||
$ret = $method->invoke(null, ...$args);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
private function _mustBeLoadService($serviceName)
|
||||
private function _internalMustBeLoadModule($fullName)
|
||||
{
|
||||
if (!array_key_exists($serviceName, $this->serviceHash)) {
|
||||
require_once('services/' . $serviceName . '.php');
|
||||
$this->serviceHash[$serviceName] = $this->_getNowTime();
|
||||
if (!array_key_exists($fullName, $this->moduleHash)) {
|
||||
require_once($fullName . '.php');
|
||||
$this->moduleHash[$fullName] = $this->_getNowTime();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,4 +22,9 @@ class BigwheelController extends BaseAuthedController
|
||||
public function buyS(){
|
||||
}
|
||||
|
||||
private function getMidDataKey()
|
||||
{
|
||||
return myself()->_getServiceConstant();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ use phpcommon\SqlHelper;
|
||||
|
||||
class MidData extends BaseModel {
|
||||
|
||||
const BIG_WHEEL_TYPE = 'offer.reward.missions';
|
||||
|
||||
public static function getData($type)
|
||||
{
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
|
Loading…
x
Reference in New Issue
Block a user