Example #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;
 }
Example #2
0
 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);
 }
Example #3
0
 public function getUserData()
 {
     return $this->userDao->getUserData(App::getUserId());
 }