FriendMapChange.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace App\Listeners;
  3. use App\Events\EachLike;
  4. use App\Events\PairSuccess;
  5. use App\Events\PairTwoSideAgree;
  6. use App\Events\UnEachLike;
  7. use App\Managers\FriendManager;
  8. use App\Models\Friends\FriendContact;
  9. use App\Models\Friends\FriendModel;
  10. use App\Models\Friends\LogModel;
  11. /**
  12. * 好友列表map变化监听器
  13. * Class FriendMapChange
  14. * @package App\Listeners
  15. */
  16. class FriendMapChange
  17. {
  18. /**
  19. * Create the event listener.
  20. *
  21. * @return void
  22. */
  23. public function __construct()
  24. {
  25. //
  26. }
  27. /**
  28. * Handle the event.
  29. *
  30. * @param object $event
  31. * @return void
  32. */
  33. public function handle($event)
  34. {
  35. }
  36. public function eachLike(EachLike $event)
  37. {
  38. $friendManager = new FriendManager();
  39. $friendManager->beContact($event->uid, $event->isLikeUid);
  40. $friendContact = new FriendContact();
  41. $friendContact->setEachLike($event->uid, $event->isLikeUid, 1);
  42. }
  43. public function unEachLike(UnEachLike $event)
  44. {
  45. $friendContact = new FriendContact();
  46. $friendContact->setEachLike($event->uid, $event->unLikeUid, 0);
  47. }
  48. /**
  49. * 分配对象活动-匹配成功
  50. * @param PairSuccess $event
  51. * @throws \Throwable
  52. */
  53. public function pairSuccess(PairSuccess $event)
  54. {
  55. $friendManager = new FriendManager();
  56. $friendManager->beContact($event->uid, $event->pairUid);
  57. }
  58. /**
  59. * 分配对象活动-双方同意
  60. * @param PairTwoSideAgree $event
  61. * @throws \Throwable
  62. */
  63. public function pairTwoSideAgree(PairTwoSideAgree $event)
  64. {
  65. $friendManager = new FriendManager();
  66. $friendManager->beFriend($event->uid, $event->pairUid);
  67. }
  68. }