sharePairManager = $sharePairManager; $this->likeManager = $likeManager; } public function pairVipCheck(PairVipCheckMessage $message) { $inviteId = $message->getInviteId(); $uid = Auth::auth(); $data = $this->sharePairManager->vipCheck($uid, $inviteId); $message->setResponse($data); } public function pairGet(PairGetMessage $message) { $listId = $message->getListId(); $data = $this->sharePairManager->get($listId); $message->setResponse($data); } public function likeMe(LikeMeMessage $message) { $praiseId = $message->getPraiseId(); $data = $this->likeManager->get($praiseId); $message->setResponse($data); } public function likeMeCheck(LikeMeCheckMessage $message) { $praiseId = $message->getPraiseId(); $uid = Auth::auth(); $data = $this->likeManager->check($uid, $praiseId); $message->setResponse($data); } public function likeMeHistory(LikeMeHistoryMessage $message) { $praiseId = $message->getPraiseId(); $data = $this->likeManager->history($praiseId); $message->setResponse($data); } public function pairApplyListShareHelp(PairApplyListShareHelpMessage $message) { $uid = Auth::auth(); $stageId = $message->getStageId(); $shareUid = $message->getShareUid(); $lockUid = $message->getLockUid(); $activity = ActivityModel::enrolling()->first(); if ( !$activity || $activity->stage_id != $stageId ) { throw new AlertException("活动报名已结束,分享已过期"); } if ( !$sharePair = PairModel::where([ array('stage_id', $stageId), array('uid', $shareUid) ])->first() ) { throw new AlertException("分享者取消报名,分享失效"); } if ( !$sharePair = PairModel::where([ array('stage_id', $stageId), array('uid', $lockUid) ])->first() ) { throw new AlertException("解锁者取消报名,分享失效"); } if ( PairApplyListShareHelpLog::where([ array('help_uid', $uid), array('share_uid', $shareUid), array('created_at', '>', mkdir(0, 0, 0)) ])->exists() ) { throw new AlertException("一天只可帮一个人助力一次"); } if ( PairApplyListShareHelpLog::where([ array('help_uid', $uid), array('share_uid', $shareUid), array('lock_uid', $lockUid), array('stage_id', $stageId) ])->exists() ) { throw new AlertException("你已经帮他助力了"); } PairApplyListShareHelpLog::create([ 'created_at' => time(), 'share_uid' => $shareUid, 'lock_uid' => $lockUid, 'stage_id' => $stageId, 'help_uid' => $uid ]); } }