Authored by hf

code review by fei.hong: do format new arrival codes

... ... @@ -867,7 +867,7 @@ class Process
'img' => $val['src']
);
}
$floor['moreBrand'] = 'http://yohobuy.com/brands';
$floor['moreBrand'] = Helpers::url('/brands');
$type_key = sprintf("%s_%s", $type, $key);
$cacheKey = sprintf("%s_%s", WebCacheConfig::KEY_WEB_INDEX_BRANDS_LIST_DATA, $type_key);
Cache::set($cacheKey, $floor, 86400);
... ...
... ... @@ -24,7 +24,7 @@ class Helpers
switch ($module) {
case 'default':
$url = 'http://m.yohobuy.com';
$url = 'http://www.yohobuy.com';
break;
case 'guang': // 逛
$url = 'http://guang' . SUB_DOMAIN;
... ...
<?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($pageIndex < 0) {
$data = HomeModel::getNewArrival($channel);
if (empty($data)) {
break;
}
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);
... ...