NoticeService.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\services\message;
  12. use app\services\BaseServices;
  13. use crmeb\services\CacheService;
  14. /**
  15. * 站内信services类
  16. * Class MessageSystemServices
  17. */
  18. class NoticeService extends BaseServices
  19. {
  20. protected $noticeInfo;
  21. protected $event;
  22. /**
  23. * 设置
  24. * @param string $event
  25. * @return $this
  26. * @throws \think\db\exception\DataNotFoundException
  27. * @throws \think\db\exception\DbException
  28. * @throws \think\db\exception\ModelNotFoundException
  29. */
  30. public function setEvent(string $event)
  31. {
  32. if ($this->event != $event) {
  33. /** @var SystemNotificationServices $services */
  34. $services = app()->make(SystemNotificationServices::class);
  35. $noticeInfo = $services->getOneNotce(['mark' => $event]);
  36. $this->noticeInfo = $noticeInfo ? $noticeInfo->toArray() : [];
  37. $this->event = $event;
  38. }
  39. return $this;
  40. }
  41. }