Voice.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace App\Services\Violation;
  3. use App\Models\Media\MediaSecure;
  4. use App\Models\PartnerModel;
  5. use App\Models\User\UserModel;
  6. use App\Services\User\PartnerService;
  7. class Voice extends ViolationAbstract
  8. {
  9. public function handle()
  10. {
  11. $this->user = UserModel::find($this->media->uid);
  12. $partner = PartnerModel::whereRaw($this->media->field_primary)->first();
  13. switch ($this->media->result) {
  14. case MediaSecure::MANUAL_SUGGESTION_BLOCK:
  15. $this->handleFailed($partner->id);
  16. break;
  17. case MediaSecure::MANUAL_SUGGESTION_PASS:
  18. $this->handleSuccess($partner->id);
  19. break;
  20. }
  21. }
  22. public function handleFailed($partnerId)
  23. {
  24. $userService = new PartnerService();
  25. $userService->check($partnerId, 'voice_check', -1);
  26. }
  27. public function handleSuccess($partnerId)
  28. {
  29. $userService = new PartnerService();
  30. $userService->check($partnerId, 'voice_check', 1);
  31. }
  32. }