- 按 docs/renew-code-comment.md 将 PHP 文件头改为带边框的 Author 注释\n- 注释中的 crmeb.com 替换为 uj345.cn(代码字符串中的外链未改)\n- 新增 docs/renew-code-comment.md 说明 Made-with: Cursor
67 lines
1.6 KiB
PHP
67 lines
1.6 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Author: ScottPan Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace crmeb\services\printer;
|
|
|
|
use crmeb\basic\BaseManager;
|
|
use think\facade\Config;
|
|
use think\Container;
|
|
|
|
/**
|
|
* Class Printer
|
|
* @package crmeb\services\auth
|
|
* @mixin \crmeb\services\printer\storage\YiLianYun
|
|
* @mixin \crmeb\services\printer\storage\FeiEYun
|
|
*/
|
|
class Printer extends BaseManager
|
|
{
|
|
|
|
/**
|
|
* 空间名
|
|
* @var string
|
|
*/
|
|
protected string $namespace = '\\crmeb\\services\\printer\\storage\\';
|
|
|
|
/**
|
|
* @var object
|
|
*/
|
|
protected $handleAccessToken;
|
|
|
|
/**
|
|
* 默认驱动
|
|
* @return mixed
|
|
*/
|
|
protected function getDefaultDriver()
|
|
{
|
|
return Config::get('printer.default', 'yi_lian_yun');
|
|
}
|
|
|
|
/**
|
|
* 获取类的实例
|
|
* @param $class
|
|
* @return mixed|void
|
|
*/
|
|
protected function invokeClass($class)
|
|
{
|
|
if (!class_exists($class)) {
|
|
throw new \RuntimeException('class not exists: ' . $class);
|
|
}
|
|
$this->getConfigFile();
|
|
|
|
if (!$this->config) {
|
|
$this->config = Config::get($this->configFile . '.stores.' . $this->name, []);
|
|
}
|
|
|
|
if (!$this->handleAccessToken) {
|
|
$this->handleAccessToken = new AccessToken($this->config, $this->name, $this->configFile);
|
|
}
|
|
|
|
$handle = Container::getInstance()->invokeClass($class, [$this->name, $this->handleAccessToken, $this->configFile]);
|
|
$this->config = [];
|
|
return $handle;
|
|
}
|
|
|
|
}
|