Event.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. class Event extends BaseDict
  13. {
  14. /**
  15. * 加载事件
  16. * @param array $data
  17. * @return array|mixed
  18. */
  19. public function load(array $data)
  20. {
  21. $addons = $this->getLocalAddons();
  22. $event_files = [];
  23. foreach ($addons as $v) {
  24. $event_path = $this->getAddonAppPath($v) . "event.php";
  25. if (is_file($event_path)) {
  26. $event_files[] = $event_path;
  27. }
  28. }
  29. $files_data = $this->loadFiles($event_files);
  30. $files_data[1] = $data;
  31. $events = [];
  32. foreach ($files_data as $file_data) {
  33. $events = empty($events) ? $file_data : array_merge2($events, $file_data);
  34. }
  35. return $events;
  36. }
  37. }