/** * 用户注册事件处理句柄 * @param object $event */ public function afterRegister($event) { //处理积分 $creditTask = new CreditTask(); $creditTask->task_name = TaskConstant::REGISTER_CREDITS_TASK; //任务名称 $creditTask->scebario = TaskConstant::REGISTER_TASK_SCEBARIO; //场景 $creditTask->data = ['user_id' => $event->userId, 'credits' => 500]; CreditsService::getService()->push(ArrayHelper::toArray($creditTask)); //处理耕币 $forumTask = new ForumTask(); $forumTask->task_name = TaskConstant::REGISTER_FORUM_TASK; $forumTask->scebario = TaskConstant::REGISTER_TASK_SCEBARIO; //场景 $forumTask->data = ['user_id' => $event->userId, 'forum' => 500]; ForumService::getService()->push(ArrayHelper::toArray($forumTask)); //用户邀请码 $invitationTask = new InvitationCodeTask(); $invitationTask->task_name = TaskConstant::REGISTER_FORUM_TASK; $invitationTask->scebario = TaskConstant::REGISTER_TASK_SCEBARIO; //场景 $invitationTask->data = ['user_id' => $event->userId]; InvitationService::getService()->push(ArrayHelper::toArray($invitationTask)); }
public function init() { $this->_queue_service = \common\services\queues\CreditsService::getService(); parent::init(); }