示例#1
0
 public function login($vkId)
 {
     $user = new User();
     $user->setVkId($vkId);
     $user->setLastLoginDate(date(Defines::SQL_DATE_TIME_FORMAT));
     $this->userDao->createOrUpdate($user);
     $session = App::getSession();
     $session->isLogged = true;
     $session->user = $user;
     $session->vkData = $this->vkService->getUser($vkId);
     return App::isLoggedUser();
 }
示例#2
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;
 }