NoticeDict.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Niucloud-admin 企业快速开发的saas管理平台
  4. // +----------------------------------------------------------------------
  5. // | 官方网址:https://www.niucloud.com
  6. // +----------------------------------------------------------------------
  7. // | niucloud团队 版权所有 开源版本可自由商用
  8. // +----------------------------------------------------------------------
  9. // | Author: Niucloud Team
  10. // +----------------------------------------------------------------------
  11. namespace app\dict\notice;
  12. use core\dict\DictLoader;
  13. /**
  14. * 消息类
  15. * Class NoticeDict
  16. * @package app\dict\sys
  17. */
  18. class NoticeDict
  19. {
  20. /**
  21. * 获取消息
  22. * @return array
  23. */
  24. public static function getNotice(string $key = '')
  25. {
  26. $addon_load = new DictLoader('Notice');
  27. $notice = $addon_load->load(['type' => 'notice']);
  28. $notice_type = NoticeTypeDict::getType();
  29. foreach ($notice_type as $k => $v) {
  30. $var_name = $k . '_notice';
  31. $$var_name = $addon_load->load(['type' => $k]);
  32. }
  33. foreach ($notice as $k => $v) {
  34. $support_type = [];
  35. foreach ($notice_type as $notice_type_k => $notice_type_v) {
  36. $var_name = $notice_type_k . '_notice';
  37. if (array_key_exists($k, $$var_name)) {
  38. $notice[$k][$notice_type_k] = $$var_name[$k];
  39. $support_type[] = $notice_type_k;
  40. }
  41. }
  42. $notice[$k]['support_type'] = $support_type;
  43. }
  44. if (!empty($key)) {
  45. return $notice[$key] ?? [];
  46. }
  47. return $notice;
  48. }
  49. }