Invoice.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace crmeb\services\invoice;
  3. use crmeb\basic\BaseManager;
  4. use crmeb\services\AccessTokenServeService;
  5. use think\Container;
  6. use think\facade\Config;
  7. class Invoice extends BaseManager
  8. {
  9. /**
  10. * 空间名
  11. * @var string
  12. */
  13. protected $namespace = '\\crmeb\\services\\invoice\\storage\\';
  14. /**
  15. * 默认驱动
  16. * @return mixed
  17. */
  18. protected function getDefaultDriver()
  19. {
  20. // return Config::get('invoice.default');
  21. return 'yihaotong';
  22. }
  23. /**
  24. * 获取类的实例
  25. * @param $class
  26. * @return mixed|void
  27. */
  28. protected function invokeClass($class)
  29. {
  30. if (!class_exists($class)) {
  31. throw new \RuntimeException('class not exists: ' . $class);
  32. }
  33. $this->getConfigFile();
  34. $handleAccessToken = new AccessTokenServeService($this->config['account'] ?? '', $this->config['secret'] ?? '');
  35. $handle = Container::getInstance()->invokeClass($class, [$this->name, $handleAccessToken, $this->configFile, $this->config]);
  36. $this->config = [];
  37. return $handle;
  38. }
  39. }