Authored by whb

最新上架修改参数

... ... @@ -46,14 +46,20 @@ class CommonController extends WebAction
HomeModel::COOKIE_NAME_LIFESTYLE
);
$channel = $this->post('type', '');
$pageIndex = $this->post('pageIndex', 1);
$pageCount = $this->post('pageCount', 8);
$pageIndex = intval($this->post('pageIndex', 1));
$pageCount = intval($this->post('pageCount', 8));
if (! in_array($channel, $channels)) {
break;
} else {
$data = HomeModel::getNewArrival($channel);
}
$result = array_slice($data, ($pageIndex - 1) * $pageCount, $pageCount);
if($pageIndex < 1) {
$pageIndex = 1;
}
if($pageCount < 1 || $pageCount > 50) {
$pageCount = 20;
}
$result = array_slice($data, $pageIndex - 1, $pageCount);
if (empty($result)) {
break;
}
... ...