InvitePaint.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 InvitePaint 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. }