InviteAnswer.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace App\Services\Violation;
  3. use App\Models\Friends\LogModel;
  4. use App\Models\Media\MediaSecure;
  5. use App\Models\User\UserModel;
  6. use PocketBE\MsyPush\Jobs\RegistEventJob;
  7. class InviteAnswer extends ViolationAbstract
  8. {
  9. public function handle()
  10. {
  11. $this->user = UserModel::find($this->media->uid);
  12. $log = LogModel::whereRaw($this->media->field_primary)->first();
  13. if ($log) {
  14. switch ($this->media->result) {
  15. case MediaSecure::MANUAL_SUGGESTION_BLOCK:
  16. $this->handleFailed($log);
  17. break;
  18. case MediaSecure::MANUAL_SUGGESTION_PASS:
  19. $this->handleSuccess($log);
  20. break;
  21. }
  22. }
  23. }
  24. public function handleFailed($log)
  25. {
  26. $log->recall();
  27. $this->notification();
  28. }
  29. /**
  30. * 通知
  31. */
  32. public function notification()
  33. {
  34. $payload = [
  35. 'to_user' => $this->user->getAuth(),
  36. 'user' => $this->user->toArray(),
  37. 'meta' => [
  38. 'field' => '心动问答',
  39. 'handle' => '已删除',
  40. ],
  41. ];
  42. dispatch(new RegistEventJob(100016, $payload))->onQueue("{push}");
  43. }
  44. public function handleSuccess($log)
  45. {
  46. }
  47. }