市场业绩离职功能提交导出修正
parent
6e767a739c
commit
d3e9f113ba
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
namespace Base\Factory;
|
||||
|
||||
use Base\Factory\LeavePercentageFactory;
|
||||
|
||||
class BaseFactory {
|
||||
|
||||
private static $instance ;
|
||||
private $suffix = "Factory";
|
||||
|
||||
public $classes = [
|
||||
'LeavePercentageFactory' => LeavePercentageFactory::class,
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
//获取实例化接口
|
||||
static function getInstance() {
|
||||
|
||||
if (!(self::$instance instanceof self)) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
|
||||
}
|
||||
//工厂类返回实例化类
|
||||
public function factoryClass($name = '') {
|
||||
|
||||
if (!$name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$className = "{$name}{$this->suffix}";
|
||||
|
||||
if ($this->classes[$className]) {
|
||||
return (new $this->classes[$className]);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue