NoticeWidget.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * Name: 芸众商城系统
  5. * Author: 广州市芸众信息科技有限公司
  6. * Profile: 广州市芸众信息科技有限公司位于国际商贸中心的广州,专注于移动电子商务生态系统打造,拥有芸众社交电商系统、区块链数字资产管理系统、供应链管理系统、电子合同等产品/服务。官网 :www.yunzmall.com www.yunzshop.com
  7. * Date: 2021/9/14
  8. * Time: 17:42
  9. */
  10. namespace app\backend\modules\goods\widget;
  11. use app\backend\modules\goods\models\Notice;
  12. use app\common\models\Member;
  13. //消息通知
  14. class NoticeWidget extends BaseGoodsWidget
  15. {
  16. public $group = 'tool';
  17. public $widget_key = 'notice';
  18. public $code = 'notification';
  19. public function pluginFileName()
  20. {
  21. return 'goods';
  22. }
  23. public function getData()
  24. {
  25. $notices = Notice::getList($this->goods->id);
  26. if (!$notices->isEmpty()) {
  27. foreach ($notices as $notice) {
  28. $noticetype[] = $notice['type'];
  29. $uid = $notice['uid'];
  30. }
  31. $member = Member::select('uid', 'nickname', 'realname', 'mobile', 'avatar')
  32. ->where('uid', $uid)
  33. ->first();
  34. } else {
  35. $noticetype = [];
  36. $member = [];
  37. }
  38. return [
  39. 'member'=> $member,
  40. 'notice_type'=>$noticetype,
  41. ];
  42. }
  43. public function pagePath()
  44. {
  45. return $this->getPath('resources/views/goods/assets/js/components/');
  46. }
  47. }