123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace App\Services\Violation;
- use App\Models\Friends\LogModel;
- use App\Models\Media\MediaSecure;
- use App\Models\User\UserModel;
- use PocketBE\MsyPush\Jobs\RegistEventJob;
- class InviteAnswer extends ViolationAbstract
- {
- public function handle()
- {
- $this->user = UserModel::find($this->media->uid);
- $log = LogModel::whereRaw($this->media->field_primary)->first();
- if ($log) {
- switch ($this->media->result) {
- case MediaSecure::MANUAL_SUGGESTION_BLOCK:
- $this->handleFailed($log);
- break;
- case MediaSecure::MANUAL_SUGGESTION_PASS:
- $this->handleSuccess($log);
- break;
- }
- }
- }
- public function handleFailed($log)
- {
- $log->recall();
- $this->notification();
- }
- /**
- * 通知
- */
- public function notification()
- {
- $payload = [
- 'to_user' => $this->user->getAuth(),
- 'user' => $this->user->toArray(),
- 'meta' => [
- 'field' => '心动问答',
- 'handle' => '已删除',
- ],
- ];
- dispatch(new RegistEventJob(100016, $payload))->onQueue("{push}");
- }
- public function handleSuccess($log)
- {
- }
- }
|