123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace App\Services\Violation;
- use App\Models\Media\MediaSecure;
- use App\Models\PartnerModel;
- use App\Models\User\UserModel;
- use PocketBE\MsyPush\Jobs\RegistEventJob;
- class Introduce extends ViolationAbstract
- {
- public function handle()
- {
- $this->user = UserModel::findOrFail($this->media->uid);
- if ($this->user->introduce == $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->introduce = '';
- $this->user->save();
- if ($partner = PartnerModel::find($this->user->partner_id)) {
- $partner->introduce = '';
- $partner->save();
- }
- $this->sendFailedNotification();
- }
- /**
- * 通知
- */
- public function sendFailedNotification()
- {
- $payload = [
- 'to_user' => $this->user->getAuth(),
- 'user' => $this->user->toArray(),
- 'meta' => [
- 'field' => '个性签名',
- 'handle' => '已被删除',
- ],
- ];
- dispatch(new RegistEventJob(100015, $payload))->onQueue("{push}");
- }
- public function handleSuccess()
- {
- }
- }
|