123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- <?php
- namespace App\Services\Pair;
- use App\Models\Fpdx\FormModel;
- use App\Models\Fpdx\PairModel;
- use App\Models\NoticeModel;
- use App\Models\User\UserModel;
- use App\Services\Service;
- use PocketBE\MsyPush\Jobs\RegistEventJob;
- class NoticeService extends Service
- {
- /**
- * 72小时-单方面确认关系通知
- * @param int $to_uid
- * @param int $pair_id
- * @return void
- */
- public function unilateralConfirm(int $to_uid, int $pair_id)
- {
- $title = "72小时-单方面确认关系通知";
- $user = UserModel::find($to_uid);
- $pair = PairModel::find($pair_id);
- $payload = [
- 'to_user' => $user->getAuth(),
- 'pair' => $pair->toArray(),
- ];
- dispatch(new RegistEventJob(10101, $payload))->onQueue("{push}");
- }
- /**
- * 单方面选择重配
- * @param int $to_user
- * @param int $pair_id
- * @return void
- */
- public function unilateralAgain(int $to_user, int $pair_id)
- {
- $title = "72小时-单方面重配通知";
- $user = UserModel::find($to_user);
- $pair = PairModel::find($pair_id);
- $payload = [
- 'to_user' => $user->getAuth(),
- 'pair' => $pair->toArray(),
- ];
- dispatch(new RegistEventJob(10102, $payload))->onQueue("{push}");
- }
- /**
- * 单方确认关系反悔通知
- * @param int $to_user
- */
- public function regretConfirm($to_user)
- {
- $title = "72小时-单方确认关系反悔通知";
- $user = UserModel::find($to_user);
- $payload = [
- 'to_user' => $user->getAuth(),
- ];
- dispatch(new RegistEventJob(10103, $payload))->onQueue("{push}");
- }
- /**
- * 单方选择重匹反悔通知
- * @param int $to_user
- */
- public function regretAgain($to_user)
- {
- $title = "72小时-单方选择重匹反悔通知";
- $user = UserModel::find($to_user);
- $payload = [
- 'to_user' => $user->getAuth(),
- ];
- dispatch(new RegistEventJob(10104, $payload))->onQueue("{push}");
- }
- /**
- * 72小时-活动群解锁通知
- * @param int $to_uid
- * @param int $pair_id
- * @return void
- */
- public function unlockGroup(int $to_uid, int $pair_id)
- {
- $title = '72小时-活动群解锁通知';
- $user = UserModel::find($to_uid);
- $pair = PairModel::find($pair_id);
- $payload = [
- 'to_user' => $user->getAuth(),
- 'pair' => $pair->toArray(),
- ];
- dispatch(new RegistEventJob(10105, $payload))->onQueue("{push}");
- }
- /**
- * 72小时-匹配结果通知
- * @param int $to_uid
- * @param int $pair_id
- * @return void
- */
- public function pairResult(int $to_uid, int $pair_id)
- {
- $title = "72小时-匹配结果通知";
- $user = UserModel::find($to_uid);
- $pair = PairModel::find($pair_id);
- $payload = [
- 'to_user' => $user->getAuth(),
- 'pair' => $pair->toArray(),
- ];
- dispatch(new RegistEventJob(10106, $payload))->onQueue("{push}");
- // 系统消息
- NoticeModel::create([
- 'uid' => $to_uid,
- 'title' => '匹配结果已公布',
- 'content' => "你参与的“72小时恋爱体验”活动第{$pair->stage_id}期,匹配结果已公布,记得要和CP确认关系,这样才会解锁活动群聊。",
- 'type' => 5,
- 'tab_content' => '查看结果',
- 'tab_url' => "/fpdx/pages/matchsuccess/matchsuccess?stage_id={$pair->stage_id}",
- ]);
- }
- /**
- * 72小时-重配结果通知
- * @param int $to_uid
- * @param int $pair_id
- * @return void
- */
- public function rematchResult($to_uid, $pair_id)
- {
- $title = "72小时-重配结果通知";
- $user = UserModel::find($to_uid);
- $pair = PairModel::find($pair_id);
- $payload = [
- 'to_user' => $user->getAuth(),
- 'pair' => $pair->toArray(),
- ];
- dispatch(new RegistEventJob(10107, $payload))->onQueue("{push}");
- }
- /**
- * 72小时活动结束反馈
- * @param int $to_uid
- * @param int $pair_id
- * @return void
- */
- public function feedback($to_uid, $pair_id)
- {
- $title = "72小时-活动反馈通知";
- $user = UserModel::find($to_uid);
- $pair = PairModel::find($pair_id);
- $form = FormModel::where('stage_id', $pair->stage_id)->where('activity_type', '72h')->first();
- $payload = [
- 'to_user' => $user->getAuth(),
- 'pair' => $pair->toArray(),
- 'form' => $form->toArray(),
- ];
- dispatch(new RegistEventJob(10108, $payload))->onQueue("{push}");
- }
- /**
- * 72小时-帮助好友助力通知
- * @param int $to_user
- * @param int $pair_id
- * @return void
- */
- public function helpToScore($to_user, $pair_id)
- {
- $title = "72小时-帮助好友助力通知";
- $user = UserModel::find($to_user);
- $pair = PairModel::find($pair_id);
- $friend_user = UserModel::find($pair->uid);
- $payload = [
- 'to_user' => $user->getAuth() ?? [],
- 'pair' => $pair->toArray(),
- 'friend_user' => $friend_user->toArray(),
- ];
- dispatch(new RegistEventJob(10109, $payload))->onQueue("{push}");
- }
- /**
- * 72小时-好友助力提高成功率通知
- * @param int $to_uid
- * @param int $pair_id
- */
- public function inviteToScore($to_uid, $pair_id)
- {
- $title = "72小时-好友助力提高成功率通知";
- $user = UserModel::find($to_uid);
- $pair = PairModel::find($pair_id);
- $payload = [
- 'to_user' => $user->getAuth(),
- 'pair' => $pair->toArray(),
- ];
- dispatch(new RegistEventJob(10110, $payload))->onQueue("{push}");
- }
- /**
- * 72小时-好友助力成功通知
- * @param int $to_uid
- * @return void
- */
- public function inviteToSuccess($to_uid)
- {
- $title = "72小时-好友助力成功通知";
- $user = UserModel::find($to_uid);
- $payload = [
- 'to_user' => $user->getAuth(),
- ];
- dispatch(new RegistEventJob(10111, $payload))->onQueue("{push}");
- // 系统消息
- NoticeModel::create([
- 'uid' => $to_uid,
- 'title' => '活动报名成功',
- 'content' => "你已成功报名活动,活动匹配结果将于下一个周四18:00公布,记得来回来查询匹配结果哦~",
- 'type' => 5,
- 'type_id' => 0,
- ]);
- }
- /**
- * 好友助力退费
- * @param int $to_uid
- * @param int $pair_id
- * @param int $dis_score
- * @return void
- */
- public function inviteToRefund($to_uid, int $pair_id, int $dis_score)
- {
- $title = "72小时-好友助力退费通知";
- $user = UserModel::find($to_uid);
- $pair = PairModel::find($pair_id);
- $payload = [
- 'to_user' => $user->getAuth(),
- 'pair' => $pair->toArray(),
- 'meta' => [
- 'dis_score' => $dis_score,
- ],
- ];
- dispatch(new RegistEventJob(10112, $payload))->onQueue("{push}");
- }
- }
|