protected function getResult($params) { extract($params); $res = $this->initWebApiArray(); if ($page == 1) { $res['piclist'] = $this->_getPicList($mid); } else { $res['piclist'] = array(); } $portals = AppbymePortalModuleSource::getPortalByMid($mid); $handCount = $this->_handCount($mid, $portals); $autoAdd = AppbymePortalModuleSource::getAutoAdd($mid); $params = unserialize(AppbymePoralModule::getModuleParam($mid)); $params == false && ($params = array()); // 对错误mid的处理 if (empty($portals)) { $res['list'] = array(); return $res; } $count = 0; // 自动添加的数目 if (!empty($autoAdd)) { if ($autoAdd[0]['idtype'] == 'fid') { // [add]板块设置用户组权限后,针对当前用户进行过滤(在列表中是否显示)Author:HanPengyu,Data:14.11.28 require_once libfile('function/forumlist'); foreach ($autoAdd as $auto) { $forum = DzForumForum::getForumFieldByFid($auto['id']); forum($forum) && ($fids[] = $auto['id']); } $count = DzForumThread::getByFidCount($fids, $params, $longitude, $latitude, $radius); // Mobcent::dumpSql(); } else { foreach ($autoAdd as $auto) { $catids[] = $auto['id']; } $count = DzPortalArticle::getByCatidCount($catids, $params); } } $total = $handCount + $count; // 没有查到数据 if ($total == 0) { $res['list'] = array(); return $res; } $pageInfo = WebUtils::getWebApiArrayWithPage_oldVersion($page, $pageSize, $total); $res = array_merge($res, $pageInfo); $offset = ($page - 1) * $pageSize; if ($page == 1) { if ($handCount <= self::HANDPAGE) { $autoData = array(); $handData = $handCount != 0 && ($page = 1) ? $this->_handData($mid, $offset, $handCount, $params) : array(); $pageInfo = WebUtils::getWebApiArrayWithPage_oldVersion($page, $handCount, $handCount); $res = array_merge($res, $pageInfo); if ($count != 0) { if ($autoAdd[0]['idtype'] == 'fid') { $autoData = $this->_autoFidData($fids, $offset, $pageSize, $params, $longitude, $latitude, $radius); } else { $autoData = $this->_autoCatidData($catids, $offset, $pageSize, $params); } $total = $count != 0 ? $count + $handCount : $handCount; $pageInfo = WebUtils::getWebApiArrayWithPage_oldVersion($page, $pageSize, $total); $res = array_merge($res, $pageInfo); } $rows = array_merge((array) $handData, (array) $autoData); $res['list'] = $rows; return $res; } $total = $count != 0 ? $count + $handCount : $handCount; $pageInfo = WebUtils::getWebApiArrayWithPage_oldVersion($page, $handCount, $total); $res = array_merge($res, $pageInfo); $res['list'] = $this->_handData($mid, $offset, $handCount); return $res; } $page = $handCount <= self::HANDPAGE ? $page : $page - 1; $offset = ($page - 1) * $pageSize; if ($count != 0) { if ($autoAdd[0]['idtype'] == 'fid') { $autoData = $this->_autoFidData($fids, $offset, $pageSize, $params, $longitude, $latitude, $radius); } else { $autoData = $this->_autoCatidData($catids, $offset, $pageSize, $params); } $pageInfo = WebUtils::getWebApiArrayWithPage_oldVersion($page, $pageSize, $count); $res = array_merge($res, $pageInfo); $res['list'] = $autoData; } else { $pageInfo = WebUtils::getWebApiArrayWithPage_oldVersion($page, $handCount, $handCount); $res = array_merge($res, $pageInfo); $res['list'] = array(); } return $res; }