Ejemplo n.º 1
0
 public function deletePhoto()
 {
     $photoId = Data::get($_POST['photoId'], Data::Int);
     $photo = new PhotosModel();
     $data = $photo->getPhotosById($photoId);
     $row = $photo->delPhotos($photoId);
     if ($row) {
         unlink($data['fileName']);
         $result['code'] = '0';
         $result['message'] = '删除成功';
     } else {
         $result['code'] = '01';
         $result['message'] = "删除失败";
     }
     echo json_encode($result);
     exit;
 }
Ejemplo n.º 2
0
 public function photoInfo()
 {
     $albumId = $_GET['albumId'];
     //实例化Model
     $photoModel = new PhotosModel();
     $albumModel = new AlbumModel();
     $commentModel = new CommentModel();
     $userModel = new UserModel();
     $articletypeModel = new ArticleTypeModel();
     $articleTagModel = new ArticleTagModel();
     //用户个人信息
     $allUserInfo = $userModel->getAllUserInfo();
     //博主个人信息
     $blogerInfo = $this->getBlogerInfo($blogerId);
     //获取所有文章分类
     $allTypes = $articletypeModel->getCatrgoryByadminId($blogerId);
     //var_dump($allTypes);
     //获取所有文章标签
     $allTags = $articleTagModel->getArticleTag();
     //最新三条评论
     $latestComments = $commentModel->getLatestComments($blogerId, '0,3');
     //根据相册id集查询所有评论
     $comments = $commentModel->getCommentByAlbumId($ArrAlbumId);
     //相册评论数
     $photoCollectNum = $commentModel->getCommentByArrAlbumId($ArrblogerId);
     $photo['photoCollectNum'] = $photoCollectNum;
     //获取该相册的所有照片
     $photoNum = $photoModel->getPhotos($blogerId, $limit = '');
     $photo['photoNum'] = $photoNum;
     //某相册的照片数量
     $photocount = $photoModel->getPhotosCountByAlbumId($AlbumId);
     $photo['photocount'] = $photocount;
     //根据照片id查询照片信息
     $photoInfo = $photoModel->getPhotosById($value['photoId']);
     if ($count > $pagesize) {
         $page = new Page($count, $p, $pagesize);
         $str = $page->show('themeuk.php');
     }
     $this->assign('page', $str);
     $this->assign('photoNum', $photoNum);
     //某相册所有照片
     $this->assign('photoCollectNum', $photoCollectNum);
     //某相册的评论总数
     $this->assign('blogerInfo', $blogerInfo);
     //某博主信息
     $this->assign('allUserInfo', $allUserInfo);
     //某用户信息
     $this->assign('latestComments', $latestComments);
     //最新三条评论
     $this->assign('allTypes', $allTypes);
     //所有文章分类
     $this->assign('photoInfo', $photoInfo);
     //照片信息
     $this->assign("allTags", $allTags);
     //所有文章标签
     $this->assign('photocount', $photocount);
     //某相册的照片数量
     $this->assign('photo', $photo);
     //照片信息
     $this->assign('comments', $comments);
     $this->display();
 }
Ejemplo n.º 3
0
 public function albumInfo()
 {
     $blogerId = Data::get($_GET['blogerId'], Data::Int);
     $albumId = Data::get($_GET['albumId'], Data::Int);
     if (!is_int($blogerId) && $blogerId <= 0) {
         R('Index', 'index');
     }
     if (!is_int($albumId) && $albumId <= 0) {
         R('Index', 'index');
     }
     // $blogerId=$_GET['blogerId'];
     // $albumId=$_GET['albumId'];
     $album = new AlbumModel();
     $albums = $album->getAlbumById($albumId);
     $photo = new PhotosModel();
     $photos = $photo->getPhotos($albumId);
     $time = 0;
     foreach ($photos as $v) {
         $addtime = strtotime($v['addTime']);
         if ($time < $addtime) {
             $time = $addtime;
         }
     }
     $time = date("Y-m-d H:i:s", $time);
     $photoCount = $photo->getPhotosCountByAlbumId($albumId);
     $comment = new CommentModel();
     $a = $comment->getCommentByAlbumId($albumId);
     $user = new UserModel();
     $comments = array();
     foreach ($a as $v) {
         $users = $v;
         $users['user'] = $user->getUserById($v['userId']);
         $comments[] = $users;
     }
     //博主个人信息
     $blogerInfo = $this->getBlogerInfo($blogerId);
     $this->assign('blogerInfo', $blogerInfo);
     //某博主信息
     $count = $this->articleCount($blogerId);
     $this->assign('count', $count);
     //某博主文章总数
     //获取所有文章标签
     $allTags = $this->getAllTags();
     $this->assign("allTags", $allTags);
     //所有文章标签
     //获取所有文章分类
     $allTypes = $this->getAllTypes($blogerId);
     $this->assign("allTypes", $allTypes);
     //某人所有文章分类
     $latestComments = $this->getLatestComments($blogerId, '0,3');
     $this->assign('latestComments', $latestComments);
     //最新三条评论
     //用户个人信息
     $allUserInfo = $this->getAllUserInfo();
     $this->assign('allUserInfo', $allUserInfo);
     //某用户信息
     //该相册下的所有评论
     $this->assign('comments', $comments);
     //该相册下的所有相片
     $this->assign('photos', $photos);
     //相片最后的添加时间
     $this->assign('time', $time);
     //相册的相片数
     $this->assign('photoCount', $photoCount);
     //相册的部分信息
     $this->assign('album', $albums);
     $this->display();
 }