示例#1
0
文件: Api.php 项目: firaga/operation
 public function getIndexList($boundary, $num, &$next, &$next_boundary)
 {
     $msglist = $this->aGetListSeq(0, 'index', $boundary, $num, $next, $next_boundary);
     $userlist = $albumlist = $photolist = $bloglist = array();
     foreach ($msglist as $v) {
         if (self::PHOTO == $v['msgtype']) {
             $userlist[$v['content']['uid']] = $v['content']['uid'];
             $albumlist[] = array('uid' => $v['content']['uid'], 'albumid' => $v['content']['albumid']);
             $photolist = array_merge($photolist, $v['content']['photolist']);
         } else {
             if (self::BLOG == $v['msgtype']) {
                 $userlist[$v['content']['uid']] = $v['content']['uid'];
                 $bloglist[] = array('uid' => $v['content']['uid'], 'blogid' => $v['content']['blogid']);
             }
         }
     }
     $userlist = Ko_Tool_Adapter::VConv($userlist, array('list', array('user_baseinfo', array('logo80'))));
     $storageApi = new KStorage_Api();
     $photoApi = new KPhoto_Api();
     $blogApi = new KBlog_Api();
     $photoinfos = $photoApi->getPhotoInfos($photolist);
     $albuminfos = $photoApi->getAlbumInfos($albumlist);
     $bloginfos = $blogApi->aGetBlogInfos($bloglist);
     foreach ($msglist as $k => &$v) {
         if (self::PHOTO == $v['msgtype']) {
             $v['content']['userinfo'] = $userlist[$v['content']['uid']];
             $v['content']['albuminfo'] = $albuminfos[$v['content']['albumid']];
             if (empty($v['content']['albuminfo'])) {
                 $this->vDelete(0, $v['msgid']);
                 unset($msglist[$k]);
             } else {
                 $photolist = array();
                 foreach ($v['content']['photolist'] as $photo) {
                     if (!empty($photoinfos[$photo['photoid']]) && $photoinfos[$photo['photoid']]['albumid'] == $photo['albumid']) {
                         $photo['image'] = $storageApi->sGetUrl($photoinfos[$photo['photoid']]['image'], 'imageView2/2/w/480/h/240');
                         $photolist[] = $photo;
                     }
                 }
                 $v['content']['photolist'] = $photolist;
                 if (empty($photolist)) {
                     $this->vDelete(0, $v['msgid']);
                     unset($msglist[$k]);
                 }
             }
         } else {
             if (self::BLOG == $v['msgtype']) {
                 $v['content']['userinfo'] = $userlist[$v['content']['uid']];
                 $v['content']['bloginfo'] = $bloginfos[$v['content']['blogid']];
                 if (empty($v['content']['bloginfo'])) {
                     $this->vDelete(0, $v['msgid']);
                     unset($msglist[$k]);
                 }
             }
         }
     }
     unset($v);
     return $msglist;
 }
示例#2
0
 public function delete($id, $before = null)
 {
     $loginApi = new KUser_loginApi();
     $uid = $loginApi->iGetLoginUid();
     if ($uid != $id['uid']) {
         throw new Exception('删除相册失败', 1);
     }
     $photoApi = new KPhoto_Api();
     if (!$photoApi->deleteAlbum($id['uid'], $id['albumid'])) {
         throw new Exception('删除相册失败', 2);
     }
     return array('key' => $id);
 }
示例#3
0
    $userinfo = Ko_Tool_Adapter::VConv($uid, array('user_baseinfo', array('logo80')));
    $photolist = $photoApi->getPhotoListBySeq($uid, $albumid, '0_0_0', $num, $next, $next_boundary, 'imageView2/2/w/240');
    $render = new KRender_www();
    if ($loginuid == $uid) {
        $allalbumlist = $photoApi->getAllAlbumList($uid);
        $render->oSetData('allalbumlist', $allalbumlist);
    }
    $render->oSetTemplate('www/photo/album.html')->oSetData('userinfo', $userinfo)->oSetData('albuminfo', $albuminfo)->oSetData('photolist', $photolist)->oSetData('page', array('num' => $num, 'next' => $next, 'next_boundary' => $next_boundary))->oSend();
});
Ko_Web_Route::VGet('item', function () {
    $loginApi = new KUser_loginApi();
    $loginuid = $loginApi->iGetLoginUid();
    $uid = Ko_Web_Request::IGet('uid');
    $photoid = Ko_Web_Request::IGet('photoid');
    $storageApi = new KStorage_Api();
    $photoApi = new KPhoto_Api();
    $photoinfo = $photoApi->getPhotoInfo($uid, $photoid);
    if (empty($photoinfo)) {
        Ko_Web_Response::VSetRedirect('/');
        Ko_Web_Response::VSend();
        exit;
    }
    $photoinfo['image_src'] = $storageApi->sGetUrl($photoinfo['image'], '');
    $photoinfo['image_small'] = $storageApi->sGetUrl($photoinfo['image'], 'imageView2/1/w/60');
    $photoinfo['image_exif'] = $storageApi->aGetImageExif($photoinfo['image']);
    $agentinfo = KUser_agentApi::get();
    if ($agentinfo['screen']['height'] < 1000) {
        $photoinfo['image'] = $storageApi->sGetUrl($photoinfo['image'], 'imageView2/2/w/600/h/600');
        $photoinfo['imagesize'] = 600;
    } else {
        $photoinfo['image'] = $storageApi->sGetUrl($photoinfo['image'], 'imageView2/2/w/800/h/800');
示例#4
0
文件: item.php 项目: firaga/operation
 private function _sendSysmsg($uid, $albumid, $photoid)
 {
     if (18 <= $uid && $uid <= 21) {
         $photoApi = new KPhoto_Api();
         $content = compact('uid', 'albumid', 'photoid');
         $content['photolist'] = $photoApi->getPhotoList($uid, $albumid, 0, 9, $total);
         $sysmsgApi = new KSysmsg_Api();
         $sysmsgApi->iSend(0, KSysmsg_Api::PHOTO, $content, $albumid);
     }
 }