PartnerFeedPoolChange.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace App\Listeners;
  3. use Illuminate\Queue\InteractsWithQueue;
  4. use Illuminate\Contracts\Queue\ShouldQueue;
  5. use Illuminate\Support\Facades\Redis;
  6. /**
  7. * 卡片信息流层级池改变
  8. */
  9. class PartnerFeedPoolChange
  10. {
  11. /**
  12. * Create the event listener.
  13. *
  14. * @return void
  15. */
  16. public function __construct()
  17. {
  18. //
  19. }
  20. /**
  21. * Handle the event.
  22. *
  23. * @param \App\Events\PartnerFeedPoolChange $event
  24. * @return void
  25. */
  26. public function handle(\App\Events\PartnerFeedPoolChange $event)
  27. {
  28. $poolhash = array(
  29. 'select',
  30. 'new',
  31. 'recommend',
  32. 'low'
  33. );
  34. foreach ($poolhash as $value) {
  35. Redis::srem("feed:pool:{$value}:sex:{$event->model->sex}", $event->model->uid);
  36. }
  37. if (1 == $event->model->is_sell && $event->model->score >= 0) {
  38. Redis::sadd("feed:pool:{$event->model->feed_pool_level}:sex:{$event->model->sex}", [$event->model->uid]);
  39. }
  40. }
  41. }