Ejemplo n.º 1
0
 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;
 }