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