Пример #1
0
 public function timeLine()
 {
     $biz = new AlbumBiz();
     $list = $biz->getTimeLine();
     return $list;
 }
Пример #2
0
 /**
  * 获得账号里所有的指定文件类型列表
  * @param int $page 当前页码
  * @param int $pageSize 当前每页大小
  * @param string $mimeType 文件类型
  * @return array
  */
 public function getList($page, $pageSize, $mimeType)
 {
     $isValid = false;
     $sharedList = array();
     $mimeTypeList = array("application/mspowerpoint", "application/msword", "application/msexcel", "application/pdf");
     foreach ($mimeTypeList as $validMimeType) {
         if ($validMimeType === $mimeType) {
             $isValid = true;
         }
     }
     $data = array();
     if (!$isValid) {
         $data['list'] = array();
         $data['totalPage'] = 0;
         return $data;
     }
     $userId = $this->user['id'];
     $fileTotal = MiniFile::getInstance()->getTotalByMimeType($userId, $mimeType);
     $pageSet = ($page - 1) * $pageSize;
     $albumBiz = new AlbumBiz();
     $shares = $albumBiz->getAllSharedPath($userId);
     $sharedTotal = 0;
     $files = array();
     if (count($shares) != 0) {
         //获取当前文件夹下的子文件
         $sharedTotal = 0;
         foreach ($shares as $filePath) {
             $count = MiniFile::getInstance()->getSharedDocTotal($filePath, $mimeType);
             $sharedTotal = $count + $sharedTotal;
             if ($count > 0) {
                 $item = array();
                 $item[] = $filePath;
                 $item[] = $count;
                 $sharedList[] = $item;
             }
         }
     }
     if ($pageSet >= $sharedTotal) {
         $pageSet = $pageSet - $sharedTotal;
         $files = MiniFile::getInstance()->getByMimeType($userId, $mimeType, $pageSet, $pageSize);
     } else {
         if ($page * $pageSize < $sharedTotal) {
             $files = $this->getSharedDoc($pageSet, $pageSize, $sharedList, $mimeType);
         } else {
             $fileArr = $this->getSharedDoc($pageSet, $sharedTotal, $sharedList, $mimeType);
             $fileList = MiniFile::getInstance()->getByMimeType($userId, $mimeType, 0, $pageSize * $page - $sharedTotal);
             if (count($fileList) != 0) {
                 $files = array_merge($fileArr, $fileList);
             } else {
                 $files = $fileArr;
             }
         }
     }
     // $files = MiniFile::getInstance()->getByMimeType($userId,$mimeType,($page-1)*$pageSize,$pageSize);
     $items = array();
     foreach ($files as $file) {
         $version = PluginMiniDocVersion::getInstance()->getVersion($file['version_id']);
         $item['file_name'] = $file['file_name'];
         $item['path'] = $file['file_path'];
         $item['mime_type'] = $version['mime_type'];
         $item['createTime'] = $version['createTime'];
         $item['type'] = $file['file_type'];
         if ($file['user_id'] != $userId) {
             $item['type'] = 2;
         }
         $item['updated_at'] = $version['created_at'];
         $item['doc_convert_status'] = $version['doc_convert_status'];
         $items[] = $item;
     }
     $data['list'] = $items;
     $data['totalPage'] = ceil(($fileTotal + $sharedTotal) / $pageSize);
     return $data;
 }