1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace App\Services\Violation;
- use App\Models\Media\MediaSecure;
- use App\Models\User\UserModel;
- use PocketBE\MsyPush\Jobs\RegistEventJob;
- class Avatar extends ViolationAbstract
- {
- /**
- * 处理违规头像
- */
- public function handle()
- {
- $this->user = UserModel::findOrFail($this->media->uid);
- if ($this->user->headimgurl == $this->media->origin) {
- switch ($this->media->result) {
- case MediaSecure::MANUAL_SUGGESTION_BLOCK:
- $this->handleFailed();
- break;
- case MediaSecure::MANUAL_SUGGESTION_PASS:
- $this->handleSuccess();
- break;
- }
- }
- }
- public function handleFailed()
- {
- $this->user->headimgurl = '';
- $this->user->save();
- $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()
- {
- }
- }
|