public function checkTask($taskId, $watchDuration = -1) { $task = $this->taskDao->getTaskById($taskId); $isDone = false; $vkId = App::getUserId(); $url = $task->getUrl(); if (isset($task)) { switch ($task->getType()) { case Defines::TASK_TYPE_LIKE: $isDone = $this->vkService->isLiked($vkId, $url); break; case Defines::TASK_TYPE_GROUP: $isDone = $this->vkService->isGroupMember($vkId, $url); break; case Defines::TASK_TYPE_FRIEND: $isDone = $this->vkService->isFriend($vkId, $url); break; case Defines::TASK_TYPE_SHARE: $isDone = $this->vkService->isShare($vkId, $url); break; case Defines::TASK_TYPE_POLL: break; case Defines::TASK_TYPE_COMMENT: break; case Defines::TASK_TYPE_VIDEO: $isDone = $this->vkService->isWatchVideo($task, $watchDuration); break; } } if ($isDone) { $this->taskDao->doTask($task->getTaskId()); } return $isDone; }
public function getTasksFromOwner($type) { $bind = ['partnerId' => App::getPartnerId(), 'ownerId' => App::getUserId()]; $where = "partnerId = :partnerId AND ownerId = :ownerId"; if ($type != 'all') { $where .= ' AND `type` = :type'; $bind['type'] = $type; } return $this->db->select('tasks', $where, $bind); }
public function getUserData() { return $this->userDao->getUserData(App::getUserId()); }