public function aGetAll() { $ret = $this->mcacheDao->vGet(self::MC_ALL_MENU); if ($ret) { return Ko_Tool_Enc::ADecode($ret); } else { $oOption = new Ko_Tool_SQL(); $infos = $this->sqMenuDao->aGetList($oOption); if ($infos) { $infos = Ko_Tool_Utils::AObjs2map($infos, "id"); $this->mcacheDao->bSet(self::MC_ALL_MENU, Ko_Tool_Enc::SEncode($infos), 86400); } return $infos; } }
public function aGetMenuIdByAdminUid($iAdminUid) { $menuIds = array(); $aRids = Ko_Tool_Singleton::OInstance('KShequ_Menu_roleUserApi')->aGetRidsIdBuyAdminUid($iAdminUid); if (!empty($aRids)) { $aRids = Ko_Tool_Utils::AObjs2ids(array_filter($this->aGetRoles($aRids), function ($v) { return $v['flag'] == KShequ_Menu_roleApi::FLAG_NORMAL; }), 'rid'); if (!empty($aRids)) { foreach ($aRids as $iRid) { $menuIds = array_merge($menuIds, Ko_Tool_Singleton::OInstance('KShequ_Menu_rolePrivacyApi')->aGetMenuIdsByRid($iRid)); } } $menuIds = array_unique(Ko_Tool_Utils::AObjs2ids($menuIds, 'menu_id')); } return $menuIds; }
/** * 配置 key 才可用 * * @return array 根据 _aKeyField 查询多条数据 */ public function aGetListByKeys($vHintId, $aKey, $sKeyField = '') { assert(1 == count($this->_aKeyField)); //获取 id 列表 $keyField = strlen($sKeyField) ? $sKeyField : $this->_aKeyField[0]; $aKey = Ko_Tool_Utils::AObjs2ids($aKey, $keyField); //排重,得到键列表 list($idkeymap, $keyidmap) = $this->_aGetListByKeys_KeyIdMap($vHintId, $aKey, 0 == strlen($this->_sSplitField)); $allkeys = array_keys($keyidmap); //过滤掉 InProcCache / MCache 中存在的key $keys = $this->_oGetDBCache()->aFilterInCache($allkeys); KO_DEBUG >= 1 && Ko_Tool_Debug::VAddTmpLog('stat/aGetListByKeys', count($allkeys) . ':' . count($keys)); //从 DB / LCache 获取剩下的 $this->_vGetListByKeysEx($vHintId, $keys, $idkeymap, $keyidmap); //拼装并返回结果 $aRet = array(); foreach ($aKey as $key) { $aRet[strval($key)] = $this->_aGet($vHintId, array($this->_aKeyField[0] => $key), true); } return $aRet; }
private function _aGetReplyCids($iOid, $aIndexCid) { if (empty($aIndexCid)) { return array(); } $replyDao = $this->_aConf['reply'] . 'Dao'; $oOption = new Ko_Tool_SQL(); $oOption->oWhere('thread_cid in (?)', $aIndexCid)->oOrderBy('cid desc')->oLimit(self::MAX_REPLY); $aReply = $this->{$replyDao}->aGetList($iOid, $oOption); return Ko_Tool_Utils::AObjs2ids($aReply, 'cid'); }
private function _aGetExkeyInfos($aField, $aData) { $aExkeyInfos = array(); foreach ($aField as $field) { $typeinfo = $this->_aGetFieldTypeInfo($field); if (isset($typeinfo['exkey'])) { $keys = Ko_Tool_Utils::AObjs2ids($aData, $field); $aExkeyInfos[$field] = $this->_aGetListByKeys_Exkey($typeinfo['exkey'], $this->_sSplitValue, $keys); } } return $aExkeyInfos; }
public function getAllAlbumDigest($uid) { if (!$uid) { return array(); } $option = new Ko_Tool_SQL(); $option->oWhere('uid = ?', $uid)->oOrderBy('sort desc'); $albumlist = $this->albumDao->aGetList($option); $albumids = Ko_Tool_Utils::AObjs2ids($albumlist, 'albumid'); $digest = $this->_getDigest($albumids); $allphotoids = array(); foreach ($digest as &$v) { $v = array_slice($v, 0, 45); $allphotoids = array_merge($allphotoids, $v); } unset($v); foreach ($allphotoids as &$v) { $v = array('uid' => $uid, 'photoid' => $v); } unset($v); $photoinfos = $this->photoDao->aGetDetails($allphotoids); $contentApi = new KContent_Api(); $aText = $contentApi->aGetText(KContent_Api::PHOTO_ALBUM_TITLE, $albumids); $recycleid = $this->_getRecycleAlbumid($uid); $storageApi = new KStorage_Api(); foreach ($albumlist as &$v) { $v['title'] = $aText[$v['albumid']]; $v['isrecycle'] = $v['albumid'] == $recycleid; $v['digest'] = $digest[$v['albumid']]; foreach ($v['digest'] as &$vv) { $vv = $photoinfos[$vv]; $vv['image'] = $storageApi->sGetUrl($vv['image'], 'imageView2/1/w/60'); } unset($vv); } unset($v); return $albumlist; }
public function aGetBlogInfos($list) { $blogids = Ko_Tool_Utils::AObjs2ids($list, 'blogid'); $infos = $this->blogDao->aGetDetails($list); $contentApi = new KContent_Api(); $aText = $contentApi->aGetTextEx(array(KContent_Api::BLOG_TITLE => $blogids, KContent_Api::BLOG_CONTENT => array('ids' => $blogids, 'maxlength' => 1000, 'ext' => '...'))); $storageApi = new KStorage_Api(); foreach ($infos as &$v) { if ('回收站' === $v['tags']) { $v = array(); } if (!empty($v)) { $v['title'] = $aText[KContent_Api::BLOG_TITLE][$v['blogid']]; $v['content'] = $aText[KContent_Api::BLOG_CONTENT][$v['blogid']]; if (strlen($v['cover'])) { $v['cover'] = $storageApi->sGetUrl($v['cover'], 'imageView2/1/w/300/h/200'); } } } unset($v); return $infos; }
Ko_Web_Response::VSetRedirect('?uid=' . $uid); Ko_Web_Response::VSend(); exit; } } } if ('回收站' === $tag) { $loginApi = new KUser_loginApi(); $loginuid = $loginApi->iGetLoginUid(); if ($loginuid != $uid) { Ko_Web_Response::VSetRedirect('?uid=' . $uid); Ko_Web_Response::VSend(); exit; } } $blogids = Ko_Tool_Utils::AObjs2ids($bloglist, 'blogid'); $contentApi = new KContent_Api(); $htmlrender = new Ko_View_Render_HTML($contentApi); $htmlrender->oSetData(KContent_Api::BLOG_TITLE, $blogids); $htmlrender->oSetData(KContent_Api::BLOG_CONTENT, array('ids' => $blogids, 'maxlength' => 1000)); $page = array('num' => $num, 'no' => $page, 'data_total' => $total); $render = new KRender_www(); $render->oSetTemplate('www/blog/user.html')->oSetData('tag', $tag)->oSetData('userinfo', $userinfo)->oSetData('taginfos', $taginfos)->oSetData('bloglist', $bloglist)->oSetData('bloghtml', $htmlrender)->oSetData('page', $page)->oSend(); }); Ko_Web_Route::VGet('post', function () { $loginApi = new KUser_loginApi(); $uid = $loginApi->iGetLoginUid(); $blogid = Ko_Web_Request::IGet('blogid'); $userinfo = Ko_Tool_Adapter::VConv($uid, array('user_baseinfo', array('logo80'))); $blogApi = new KBlog_Api(); $taginfos = $blogApi->aGetAllTaginfo($uid);