|
|
<?php
|
|
|
use Action\WebAction;
|
|
|
use Index\HomeModel;
|
|
|
use Configs\WebCacheConfig;
|
|
|
use LibModels\Web\Home\IndexData;
|
|
|
use WebPlugin\Cache;
|
|
|
use Configs\WebCacheConfig;
|
|
|
use Api\Yohobuy;
|
|
|
use WebPlugin\Images;
|
|
|
use WebPlugin\Helpers;
|
|
|
|
...
|
...
|
@@ -16,15 +15,27 @@ class CommonController extends WebAction |
|
|
*/
|
|
|
public function getIndexResourceBrandAction()
|
|
|
{
|
|
|
$data = array();
|
|
|
|
|
|
do {
|
|
|
if (!$this->isAjax()) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$type = $this->get('type');
|
|
|
if (empty($type)) {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
|
|
// 首页资源品牌,采用内存存储
|
|
|
$type = $this->get('type');
|
|
|
$data = array();
|
|
|
if (! empty($type)) {
|
|
|
$key = WebCacheConfig::KEY_WEB_INDEX_BRANDS_LIST_DATA . '_' . $type;
|
|
|
// array('logoBrand'=>'','moreBrand'=>'')
|
|
|
$data = Cache::get($key);
|
|
|
}
|
|
|
echo $this->echoJson($data);
|
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -36,7 +47,7 @@ class CommonController extends WebAction |
|
|
*/
|
|
|
public function getNewArrivalAction()
|
|
|
{
|
|
|
$result = $data = array();
|
|
|
$result = array();
|
|
|
do {
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (! $this->isAjax()) {
|
...
|
...
|
@@ -53,23 +64,29 @@ class CommonController extends WebAction |
|
|
$pageCount = (int) $this->post('pageCount', 8);
|
|
|
if (! in_array($channel, $channels)) {
|
|
|
break;
|
|
|
} else {
|
|
|
}
|
|
|
|
|
|
$data = HomeModel::getNewArrival($channel);
|
|
|
if (empty($data)) {
|
|
|
break;
|
|
|
}
|
|
|
if($pageIndex < 0) {
|
|
|
|
|
|
if ($pageIndex < 0) {
|
|
|
$pageIndex = 0;
|
|
|
}
|
|
|
if($pageCount < 0 || $pageCount > 50) {
|
|
|
if ($pageCount < 0 || $pageCount > 50) {
|
|
|
$pageCount = 20;
|
|
|
}
|
|
|
$result = array_slice($data, $pageIndex, $pageCount);
|
|
|
if (empty($result)) {
|
|
|
$data = array_slice($data, $pageIndex, $pageCount);
|
|
|
if (empty($data)) {
|
|
|
break;
|
|
|
}
|
|
|
$result = array(
|
|
|
'code' => 200,
|
|
|
'goods' => $result
|
|
|
'goods' => $data
|
|
|
);
|
|
|
$data = array();
|
|
|
|
|
|
} while (false);
|
|
|
|
|
|
$this->echoJson($result);
|
...
|
...
|
|