Printer.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Niucloud-admin 企业快速开发的saas管理平台
  4. // +----------------------------------------------------------------------
  5. // | 官方网址:https://www.niucloud.com
  6. // +----------------------------------------------------------------------
  7. // | niucloud团队 版权所有 开源版本可自由商用
  8. // +----------------------------------------------------------------------
  9. // | Author: Niucloud Team
  10. // +----------------------------------------------------------------------
  11. namespace core\dict;
  12. use app\service\admin\site\SiteService;
  13. class Printer extends BaseDict
  14. {
  15. /**
  16. * 打印模板类型
  17. * @param array $data
  18. * @return array|mixed
  19. */
  20. public function load(array $data)
  21. {
  22. $addons = ( new SiteService() )->getAddonKeysBySiteId();
  23. $types_files = [];
  24. foreach ($addons as $v) {
  25. $types_path = $this->getAddonDictPath($v) . "printer" . DIRECTORY_SEPARATOR . "type.php";
  26. if (is_file($types_path)) {
  27. $types_files[] = $types_path;
  28. }
  29. }
  30. $types_files_data = $this->loadFiles($types_files);
  31. $types = $data;
  32. foreach ($types_files_data as $file_data) {
  33. $types = empty($types) ? $file_data : array_merge2($types, $file_data);
  34. }
  35. return $types;
  36. }
  37. }