ExternalAndFollowOperateEvent.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace App\Events;
  3. //外部人员与跟进员工操作事件新增,删除外部人员,删除跟进员工
  4. use Illuminate\Broadcasting\Channel;
  5. use Illuminate\Broadcasting\InteractsWithSockets;
  6. use Illuminate\Broadcasting\PrivateChannel;
  7. use Illuminate\Foundation\Events\Dispatchable;
  8. use Illuminate\Queue\SerializesModels;
  9. class ExternalAndFollowOperateEvent
  10. {
  11. use Dispatchable, InteractsWithSockets,SerializesModels;
  12. /*
  13. * 企微ID
  14. */
  15. public $corpId;
  16. /*
  17. * 跟进成员ID
  18. */
  19. public $followUserId;
  20. /*
  21. * 外部联系人ID
  22. */
  23. public $externalUserId;
  24. /*
  25. * 事件类型:1:添加好友、2:删除企业客户(用户)、3:删除跟进人员(内部员工)
  26. */
  27. public $eventType;
  28. /*
  29. * 企业自定义的state参数,用于区分不同的添加渠道
  30. */
  31. public $state = '';
  32. /**
  33. * Create a new event instance.
  34. *
  35. * @param $corpId
  36. * @param $followUserId
  37. * @param $externalUserId
  38. * @param $eventType
  39. * @param $state
  40. */
  41. public function __construct($corpId, $followUserId , $externalUserId, $eventType, $state='')
  42. {
  43. $this->corpId = $corpId;
  44. $this->followUserId = $followUserId;
  45. $this->externalUserId = $externalUserId;
  46. $this->eventType = $eventType;
  47. $this->state = $state;
  48. }
  49. /**
  50. * Get the channels the event should broadcast on.
  51. *
  52. * @return Channel|array
  53. */
  54. public function broadcastOn()
  55. {
  56. return new PrivateChannel('channel-name');
  57. }
  58. }